HIBERNATE / CATATAN</>↗Hibernate17 Okt 2008
In this demo you’ll see how to order the result set of out Criteria query. It can be done by adding the org.hibernate.criterion.Order into the Criteria object, and we can either order the result in ascending or descending order. package org.kodejava.hibernate; import org.hibernate.SessionFactory; import org.hibernate.Session; import org.hibernate.HibernateException; import org.hibernate.Criteria; import org.hibernate.cfg.Configuration; import org.hibernate.criterion.Order; im...
HIBERNATE / CATATAN</>↗Hibernate15 Okt 2008
In this example you’ll learn how to add restrictions to the Criteria object. Using restriction we can narrow the result of our query. In the code below we add some restrictions such as Restrictions.eq(), Restrictions.like() and Restrictions.isNotNull(). In Hibernate framework you’ll find a lot of class the use a method chaining. As in the example […]
HIBERNATE / CATATAN</>↗Hibernate12 Okt 2008
To create a pagination or limit the result set returned by the Criteria query we can use the setFirstResult() and setMaxResults() method. The setFirstResult() method defines the first row to start with and the setMaxResults() method defines the maximum number of records to read. Let’s see the demo below. package org.kodejava.hibernate; import org.hibernate.SessionFactory; import org.hibernate.Session; […]
HIBERNATE / CATATAN</>↗Hibernate07 Okt 2008
This example show you how to create an instance of Hibernate Criteria class. To create a Criteria we call the factory method of the Session object and pass the persistence class as parameter. To execute the Criteria query we simply call the list() method. package org.kodejava.hibernate; import org.hibernate.SessionFactory; import org.hibernate.Session; import org.hibernate.HibernateException; import org.hibernate.Criteria; import […]
SWING / CATATAN</>↗Swing05 Okt 2008
This example demonstrate how to create a message dialog box using the JOptionPane class methods. In the code below you’ll see the use of JOptionPane.showMessageDialog(), JOptionPane.showInputDialog() and JOptionPane.showConfirmDialog(). package org.kodejava.swing; import javax.swing.*; import java.awt.*; public class MessageDialogDemo extends JFrame { public MessageDialogDemo() throws HeadlessException { initialize(); } public static void main(String[] args) { SwingUtilities....
CORE API / CATATAN</>↗Core API03 Okt 2008
This example demonstrate how to execute an external command from Java and obtain the result of the command. Here we simply execute a Linux ls -al command on the current working directory and display the result. package org.kodejava.lang; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; public class ProcessResult { public static void main(String[] args) { try […]