CORE API / CATATAN</>↗Core API07 Okt 2007
The Integer.getInteger() methods allows us to easily read system property and convert it directly to Integer object. This method call the System.getProperty() method and then convert it to integer by calling the Integer.decode() method. package org.kodejava.lang; public class IntegerProperty { public static void main(String[] args) { // Add properties to the system. In this example […]
CORE API / CATATAN</>↗Core API04 Okt 2007
The static Integer.decode() method can be used to convert a string representation of a number into an Integer object. Under the cover this method call the Integer.valueOf(String s, int radix). The string can start with the optional negative sign followed with radix specified such as 0x, 0X, # for hexadecimal value, 0 (zero) for octal […]
CORE API / CATATAN</>↗Core API29 Sep 2007
Previously for obtaining a MAC address we need to use a native code as a solution. In JDK 1.6 a new method is added in the java.net.NetworkInterface class, this method is getHardwareAddress(). package org.kodejava.net; import java.net.InetAddress; import java.net.NetworkInterface; import java.net.SocketException; import java.net.UnknownHostException; public class MacAddress { public static void main(String[] args) { try { // […]
HIBERNATE / CATATAN</>↗Hibernate28 Sep 2007
In this example we add the function to read a list of records in our LabelService class. This function will read all Label persistent object from database. You can see the other functions such as saveLabel, getLabel and deleteLabel in the related example section of this example. package org.kodejava.hibernate.service; import org.hibernate.Session; import org.kodejava.hibernate.SessionFactoryHelper; import org.kodejava.hibernate.model.Label; […]
HIBERNATE / CATATAN</>↗Hibernate23 Sep 2007
Continuing the previous example How do I get object from database in Hibernate?, we now add the delete function in our LabelService class. package org.kodejava.hibernate.service; import org.hibernate.Session; import org.kodejava.hibernate.SessionFactoryHelper; import org.kodejava.hibernate.model.Label; public class LabelService { public Label getLabel(Long id) { Session session = SessionFactoryHelper.getSessionFactory().getCurrentSession(); session.beginTransaction(); // We g...
HIBERNATE / CATATAN</>↗Hibernate19 Sep 2007
In the How do I store object in Hibernate? example you’ll see how tho store objects into database. In this example we’ll extend the LabelService class and add the capability to get or query object from database. package org.kodejava.hibernate.service; import org.hibernate.Session; import org.kodejava.hibernate.SessionFactoryHelper; import org.kodejava.hibernate.model.Label; public class LabelService { public Label getLabel(Long id) { Session […]