Saturday, April 21, 2012

Hibernate Demo


package com.hibernate.venkat;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity

public class Pungi  {
  /**
*
*/

private int id;
private String Fitness;
private String Company;

@Id
@GeneratedValue
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getFitness() {
return Fitness;
}
public void setFitness(String fitness) {
Fitness = fitness;
}
public String getCompany() {
return Company;
}
public void setCompany(String company) {
Company = company;
}
@Override
public String toString() {
return "Pungi [id=" + id + ", Fitness=" + Fitness + ", Company=" + Company
+ "]";
}


 
}
---------------------------------------------------------------------------------------------

package com.hibernate.venkat;

import java.util.Date;
import java.util.Iterator;
import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.tool.hbm2ddl.SchemaExport;

/**
 * @author venkat
 *
 */
public class TestStudent {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
AnnotationConfiguration config=new AnnotationConfiguration();
config.addAnnotatedClass(Pungi.class);
config.configure("hibernate.cfg.xml");

//new SchemaExport(config).create(true, true);


SessionFactory sf=config.buildSessionFactory();
Session session = sf.getCurrentSession();
session.beginTransaction();

Query q=session.createQuery("from Pungi where id>1 and company=''");
List list=q.list();

for (Iterator iterator = list.iterator(); iterator.hasNext();) {
Pungi object = (Pungi) iterator.next();
System.out.println(object.toString());
}


}

}
----------------------------------------
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

    <session-factory>

        <!-- Database connection settings -->
        <property name="connection.driver_class">oracle.jdbc.OracleDriver</property>
        <property name="connection.url">jdbc:oracle:thin:@localhost:1521:xe</property>
        <property name="connection.username">venkat</property>
        <property name="connection.password">venkat</property>

        <!-- JDBC connection pool (use the built-in) -->
        <property name="connection.pool_size">2</property>

        <!-- SQL dialect -->
        <property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>

        <!-- Enable Hibernate's current session context -->
        <property name="current_session_context_class">thread</property>

        <!-- Disable the second-level cache  -->
        <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql">true</property>
        

        <!-- Drop and re-create the database schema on startup -->
<!--         <property name="hbm2ddl.auto">create</property> -->

<!--         <mapping resource="org/hibernate/tutorial/domain/Event.hbm.xml"/> -->
<!--         <mapping resource="org/hibernate/tutorial/domain/Person.hbm.xml"/> -->

    </session-factory>

</hibernate-configuration>


Hibernate CRUD Operations


package com.hibernate.venkat;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.tool.hbm2ddl.SchemaExport;

/**
 * @author venkat
 *
 */
public class TestUser {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
AnnotationConfiguration config=new AnnotationConfiguration();
config.addAnnotatedClass(UserDeatils.class);
config.configure("hibernate.cfg.xml");

//new SchemaExport(config).create(true, true);


SessionFactory sf=config.buildSessionFactory();
Session s=sf.getCurrentSession();
s.beginTransaction();

//for (int i = 1; i <=10; i++) {
// UserDeatils user=new UserDeatils();
// user.setUserName("User "+i);
// s.save(user);
//
//}
UserDeatils user=new UserDeatils();

user=(UserDeatils)s.get(UserDeatils.class, 7);

user.setUserName("Updated user 7");

s.update(user);
System.out.println("Data fetched from Table  "+user.getUserName());

user=(UserDeatils)s.get(UserDeatils.class, 2);
System.out.println(user.getUserName());



s.getTransaction().commit();






}

}
---------------------------------------------------------------------------------------------

package com.hibernate.venkat;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

@Entity
public class UserDeatils {

private int userId;
private String userName;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
---------------------------------------------------------------------------------------------
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

    <session-factory>

        <!-- Database connection settings -->
        <property name="connection.driver_class">oracle.jdbc.OracleDriver</property>
        <property name="connection.url">jdbc:oracle:thin:@localhost:1521:xe</property>
        <property name="connection.username">venkat</property>
        <property name="connection.password">venkat</property>

        <!-- JDBC connection pool (use the built-in) -->
        <property name="connection.pool_size">2</property>

        <!-- SQL dialect -->
        <property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>

        <!-- Enable Hibernate's current session context -->
        <property name="current_session_context_class">thread</property>

        <!-- Disable the second-level cache  -->
        <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql">true</property>
        

        <!-- Drop and re-create the database schema on startup -->
<!--         <property name="hbm2ddl.auto">create</property> -->

<!--         <mapping resource="org/hibernate/tutorial/domain/Event.hbm.xml"/> -->
<!--         <mapping resource="org/hibernate/tutorial/domain/Person.hbm.xml"/> -->

    </session-factory>

</hibernate-configuration>

Hibernate Compoundkey


package com.hibernate.venkat;

import javax.persistence.Entity;
import javax.persistence.Id;



/**
 * @author vt013s
 *
 */
@Entity
public class Accounts{


private CompoundKey compoundkey;
private int accountbalance;

@Id
public CompoundKey getCompoundkey() {
return compoundkey;
}
public void setCompoundkey(CompoundKey compoundkey) {
this.compoundkey = compoundkey;
}
public int getAccountbalance() {
return accountbalance;
}
public void setAccountbalance(int accountbalance) {
this.accountbalance = accountbalance;
}




}
-------------------------------------------------------------------------
package com.hibernate.venkat;

import java.io.Serializable;

import javax.persistence.Embeddable;
@Embeddable
public class CompoundKey  implements Serializable{

/**
*/
private static final long serialVersionUID = -571031490335757858L;
private int userId;
private int accountId;
public CompoundKey(int userId, int accountId) {
super();
this.userId = userId;
this.accountId = accountId;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public int getAccountId() {
return accountId;
}
public void setAccountId(int accountId) {
this.accountId = accountId;
}
}
---------------------------------------------------------------------------------------------
package com.hibernate.venkat;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.tool.hbm2ddl.SchemaExport;

/**
 * @author vt013s
 *
 */
public class TestAccount {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
AnnotationConfiguration config=new AnnotationConfiguration();
config.addAnnotatedClass(Accounts.class);
config.configure("hibernate.cfg.xml");

new SchemaExport(config).create(true, true);

SessionFactory sf=config.buildSessionFactory();
Session s= sf.getCurrentSession();
s.beginTransaction();

CompoundKey key=new CompoundKey(100,10000);
CompoundKey key1=new CompoundKey(101,20000);

Accounts savings= new Accounts();
savings.setCompoundkey(key);
savings.setAccountbalance(8500);
s.save(savings);

Accounts checking= new Accounts();
checking.setCompoundkey(key1);
checking.setAccountbalance(9500);
s.save(checking);

s.getTransaction().commit();

}

}
---------------------------------------------------------------------------------------------

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

    <session-factory>

        <!-- Database connection settings -->
        <property name="connection.driver_class">oracle.jdbc.OracleDriver</property>
        <property name="connection.url">jdbc:oracle:thin:@localhost:1521:xe</property>
        <property name="connection.username">venkat</property>
        <property name="connection.password">venkat</property>

        <!-- JDBC connection pool (use the built-in) -->
        <property name="connection.pool_size">2</property>

        <!-- SQL dialect -->
        <property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>

        <!-- Enable Hibernate's current session context -->
        <property name="current_session_context_class">thread</property>

        <!-- Disable the second-level cache  -->
        <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql">true</property>

        <!-- Drop and re-create the database schema on startup -->
<!--         <property name="hbm2ddl.auto">create</property> -->

<!--         <mapping resource="org/hibernate/tutorial/domain/Event.hbm.xml"/> -->
<!--         <mapping resource="org/hibernate/tutorial/domain/Person.hbm.xml"/> -->

    </session-factory>

</hibernate-configuration>

Hibernate Annotation Examples


package com.hibernate.venkat;

import java.util.Calendar;
import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;



/**
 * @author venkat
 *
 */
@Entity
@Table(name="EmployeeInfo")
public class Employee {

/**
* @param args
*/
private int empId;
private String empName;
private String empPassword;
private String empEmailAddress;
private boolean permanent;
private Calendar empJoinDate;
private Date empLoginTime;

@Transient
public String getEmpPassword() {
return empPassword;
}
public void setEmpPassword(String empPassword) {
this.empPassword = empPassword;
}

@Column(nullable=false)
public String getEmpEmailAddress() {
return empEmailAddress;
}
public void setEmpEmailAddress(String empEmailAddress) {
this.empEmailAddress = empEmailAddress;
}
@Basic
public boolean isPermanent() {
return permanent;
}
public void setPermanent(boolean permanent) {
this.permanent = permanent;
}
@Temporal(TemporalType.DATE)
public Calendar getEmpJoinDate() {
return empJoinDate;
}
public void setEmpJoinDate(Calendar empJoinDate) {
this.empJoinDate = empJoinDate;
}
@Temporal(TemporalType.TIMESTAMP)
public Date getEmpLoginTime() {
return empLoginTime;
}
public void setEmpLoginTime(Date empLoginTime) {
this.empLoginTime = empLoginTime;
}


@Id
@Column(name="EmployeeId")
public int getEmpId() {
return empId;
}
public void setEmpId(int empId) {
this.empId = empId;
}


public String getEmpName() {
return empName;
}
public void setEmpName(String empName) {
this.empName = empName;
}


}
---------------------------------------------------------------------------------------------
package com.hibernate.venkat;

import java.sql.Date;
import java.util.GregorianCalendar;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.tool.hbm2ddl.SchemaExport;

/**
 * @author venkat
 *
 */
public class TestEmployee {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
AnnotationConfiguration config=new AnnotationConfiguration();
config.addAnnotatedClass(Employee.class);
config.configure("hibernate.cfg.xml");

//new SchemaExport(config).create(true, true);

SessionFactory factory=config.buildSessionFactory();
Session session=factory.getCurrentSession();
session.beginTransaction();
Employee emp=new Employee();
emp.setEmpId(102);
emp.setEmpName("Sunil Narsipura");
emp.setEmpEmailAddress("narsip@att.com");
emp.setEmpJoinDate(new GregorianCalendar(2012,03,21));
emp.setEmpLoginTime(Date.valueOf("2012-03-21"));
emp.setEmpPassword("sunil");
emp.setPermanent(false);
session.save(emp);
session.getTransaction().commit();


}

}
---------------------------------------------------------------------------------------------
package com.hibernate.venkat;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

@Entity
@Table(name="Student",schema="venkat")
public class Student {

private String Sname;
private int Sno;
public String getSname() {
return Sname;
}
public void setSname(String sname) {
Sname = sname;
}
@Id
@TableGenerator(name="studentId",table="studentpktb"
,pkColumnName="stukey",pkColumnValue="studentValue",allocationSize=1)
@GeneratedValue(strategy=GenerationType.TABLE,generator="studentId")
public int getSno() {
return Sno;
}
public void setSno(int sno) {
Sno = sno;
}
}
---------------------------------------------------------------------------------------------
/**
 * 
 */
package com.hibernate.venkat;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.tool.hbm2ddl.SchemaExport;

/**
 * @author Venkat
 *
 */
public class TestStudent {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
AnnotationConfiguration config=new AnnotationConfiguration();
config.addAnnotatedClass(Student.class);
config.configure();
new SchemaExport(config).create(true, true);
SessionFactory sf= config.buildSessionFactory();
Session s=sf.getCurrentSession();
s.beginTransaction();
Student s1=new Student();
s1.setSname("satya");
Student s2=new Student();
s2.setSname("krishna");
Student s3=new Student();
s3.setSname("pavan");
s.save(s1);
s.save(s2);
s.save(s3);
s.getTransaction().commit();

}

}
---------------------------------------------------------------------------------------------
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

    <session-factory>

        <!-- Database connection settings -->
        <property name="connection.driver_class">oracle.jdbc.OracleDriver</property>
        <property name="connection.url">jdbc:oracle:thin:@localhost:1521:xe</property>
        <property name="connection.username">venkat</property>
        <property name="connection.password">venkat</property>

        <!-- JDBC connection pool (use the built-in) -->
        <property name="connection.pool_size">2</property>

        <!-- SQL dialect -->
        <property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>

        <!-- Enable Hibernate's current session context -->
        <property name="current_session_context_class">thread</property>

        <!-- Disable the second-level cache  -->
        <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql">true</property>

        <!-- Drop and re-create the database schema on startup -->
<!--         <property name="hbm2ddl.auto">create</property> -->

<!--         <mapping resource="org/hibernate/tutorial/domain/Event.hbm.xml"/> -->
<!--         <mapping resource="org/hibernate/tutorial/domain/Person.hbm.xml"/> -->

    </session-factory>

</hibernate-configuration>


Hibernate Enum Example


/**
 *
 */
package com.venkat.hibernate3;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Id;

/**
 * @author Venkat
 *
 */
@Entity
public class Cricket {

private String name;
private int runs;
private Gender gender;
@Id
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getRuns() {
return runs;
}
public void setRuns(int runs) {
this.runs = runs;
}
@Enumerated(EnumType.STRING)
public Gender getGender() {
return gender;
}
public void setGender(Gender gender) {
this.gender = gender;
}
@Override
public String toString() {
return "Cricket [name=" + name + ", runs=" + runs + ", gender="
+ gender + "]";
}


}
---------------------------------------------------------------------------------------------
package com.venkat.hibernate3;

public enum Gender {
MALE,FEMALE
}
---------------------------------------------------------------------------------------------
/**
 * 
 */
package com.venkat.hibernate3;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

/**
 * @author Venkat
 *
 */
public class HiberateTest {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
SessionFactory sf=new Configuration().configure().buildSessionFactory();
Session s=sf.openSession();
s.beginTransaction();
Cricket c=new Cricket();
c.setName("Venkat");
c.setRuns(9877);
c.setGender(Gender.MALE);
s.save(c);
Cricket c1=new Cricket();
c1.setName("Dhoni");
c1.setRuns(8877);
c1.setGender(Gender.MALE);
s.save(c1);
s.getTransaction().commit();
s.close();
c=null;
s=sf.openSession();
c=(Cricket) s.get(Cricket.class, "Dhoni");
System.out.println("The runs of the Dhoni "+c.getRuns());
System.out.println(c.toString());
}

}
---------------------------------------------------------------------------------------------
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

    <session-factory>

        <!-- Database connection settings -->
        <property name="connection.driver_class">oracle.jdbc.OracleDriver</property>
        <property name="connection.url">jdbc:oracle:thin:@localhost:1521:xe</property>
        <property name="connection.username">venkat</property>
        <property name="connection.password">venkat</property>

        <!-- JDBC connection pool (use the built-in) -->
        <property name="connection.pool_size">2</property>

        <!-- SQL dialect -->
        <property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>

        <!-- Enable Hibernate's current session context -->
        <property name="current_session_context_class">thread</property>

        <!-- Disable the second-level cache  -->
        <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql">true</property>

        <!-- Drop and re-create the database schema on startup -->
         <property name="hbm2ddl.auto">create</property> 
         <mapping class="com.venkat.hibernate3.Cricket"/>

<!--         <mapping resource="org/hibernate/tutorial/domain/Event.hbm.xml"/> -->
<!--         <mapping resource="org/hibernate/tutorial/domain/Person.hbm.xml"/> -->

    </session-factory>

</hibernate-configuration>
---------------------------------------------------------------------------------------------
### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

### set log levels - for more verbose logging change 'info' to 'debug' ###

log4j.rootLogger=warn, stdout

log4j.logger.org.hibernate=info
#log4j.logger.org.hibernate=debug

### log HQL query parser activity
#log4j.logger.org.hibernate.hql.ast.AST=debug

### log just the SQL
#log4j.logger.org.hibernate.SQL=debug

### log JDBC bind parameters ###
log4j.logger.org.hibernate.type=info
#log4j.logger.org.hibernate.type=debug

### log schema export/update ###
log4j.logger.org.hibernate.tool.hbm2ddl=debug

### log HQL parse trees
#log4j.logger.org.hibernate.hql=debug

### log cache activity ###
#log4j.logger.org.hibernate.cache=debug

### log transaction activity
#log4j.logger.org.hibernate.transaction=debug

### log JDBC resource acquisition
#log4j.logger.org.hibernate.jdbc=debug

### enable the following line if you want to track down connection ###
### leakages when using DriverManagerConnectionProvider ###
#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace


Hibernate Ecache Example


/**
 *
 */
package com.venkat.hibernate3;

import javax.persistence.Entity;
import javax.persistence.Id;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * @author Venkat
 *
 */
@Entity
@Cache(usage=CacheConcurrencyStrategy.READ_ONLY)
public class Cricket {

private String name;
private int runs;
@Id
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getRuns() {
return runs;
}
public void setRuns(int runs) {
this.runs = runs;
}


}
---------------------------------------------------------------------------------------------
/**
 * 
 */
package com.venkat.hibernate3;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

/**
 * @author Venkat
 *
 */
public class HiberateTest {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
SessionFactory sf=new Configuration().configure().buildSessionFactory();
Session s=sf.openSession();
s.beginTransaction();
Cricket c=new Cricket();
c.setName("Venkat");
c.setRuns(9877);
s.save(c);
Cricket c1=new Cricket();
c1.setName("Dhoni");
c1.setRuns(8877);
s.save(c1);
Cricket c2=new Cricket();
c2.setName("Sunil");
c2.setRuns(9997);
s.save(c2);
s.getTransaction().commit();
s.close();
c=null;
s=sf.openSession();
c=(Cricket) s.get(Cricket.class, "Dhoni");
System.out.println("The runs of the Dhoni "+c.getRuns());
}

}
---------------------------------------------------------------------------------------------
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

    <session-factory>

        <!-- Database connection settings -->
        <property name="connection.driver_class">oracle.jdbc.OracleDriver</property>
        <property name="connection.url">jdbc:oracle:thin:@localhost:1521:xe</property>
        <property name="connection.username">venkat</property>
        <property name="connection.password">venkat</property>

        <!-- JDBC connection pool (use the built-in) -->
        <property name="connection.pool_size">2</property>

        <!-- SQL dialect -->
        <property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>

        <!-- Enable Hibernate's current session context -->
        <property name="current_session_context_class">thread</property>

        <!-- Disable the second-level cache  -->
        <property name="cache.use_second_level_cache">true</property>
        <property name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property>

        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql">true</property>

        <!-- Drop and re-create the database schema on startup -->
         <property name="hbm2ddl.auto">create</property> 
         <mapping class="com.venkat.hibernate3.Cricket"/>

<!--         <mapping resource="org/hibernate/tutorial/domain/Event.hbm.xml"/> -->
<!--         <mapping resource="org/hibernate/tutorial/domain/Person.hbm.xml"/> -->

    </session-factory>

</hibernate-configuration>

Monday, March 26, 2012

Hibernate Annotation


Introduction
   - give the context of this presentation
Java Persistence Choices
   - what else is out there besides Hibernate
Terminology
   - cover some common terms
Configuring Hibernate/JPA
   - what it takes to persist your classes and fields
Working with Persistent Objects
   - persisting/modifying/deleting/querying
Gotchas
   - this could probably be an entire presentation by itself
Final Comments
Warning: I am not an expert, but rather a battle scarred Hibernate user since 2007