SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

CORE API / NOTES</>↗
Core API29 Sep 2007

How do I get MAC address of a host?

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 { // […]

Wayan · 1 min read
HIBERNATE / NOTES</>↗
Hibernate28 Sep 2007

How do I retrieve a list of Hibernate’s persistent objects?

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; […]

Wayan · 2 min read
HIBERNATE / NOTES</>↗
Hibernate23 Sep 2007

How do I delete persistent object in Hibernate?

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...

Wayan · 2 min read
HIBERNATE / NOTES</>↗
Hibernate19 Sep 2007

How do I retrieve object from database in Hibernate?

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 […]

Wayan · 2 min read
HIBERNATE / NOTES</>↗
Hibernate16 Sep 2007

How do I store object in Hibernate?

This example shows you how to store or save Hibernate object to database. The basic steps in creating application in Hibernate will be: Creates the POJO Create hibernate mapping file Register the mapping file in hibernate configuration Create a simple service class to store the object In this example we’ll create a class called Label, […]

Wayan · 4 min read
HIBERNATE / NOTES</>↗
Hibernate14 Sep 2007

How do I create Hibernate’s SessionFactory?

When creating an application the use Hibernate to manage our application persistence object we’ll need a SessionFactory. This factory creates or open a session to talk to a database. To create a SessionFactory we can define the configuration in hibernate.properties, hibernate.cfg.xml or create it programmatically. In this example we’ll use the hibernate.cfg.xml configuration file, which […]

Wayan · 4 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.