Hibernate learning notes

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

1 on the Hibernate anomaly:

org.hibernate.service.jndi.JndiException: Error parsing JNDI name


Just contact Hibernate, debugging a simple program report abnormal:

org.hibernate.service.jndi.JndiException: Error parsing JNDI name

Remove the hibernate.cfg.xml

<session-factory name="sessionFactory">

In the   name property, abnormal termination;.

Did not know is what reason.


2.JDBC for SQL Server link:

 <property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>

<property name="hibernate.connection.url">jdbc:sqlserver://xxh\xsql2008;DatabaseName=yourdatabase;SelectMethod=cursor</property>

<property name="hibernate.connection.username">sa</property>

<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>

Note that the driver and URL description


The 3 table mapping

Can be placed in the hibernate.cfg.xml:

<mapping resource="Person.hbm.xml"/>

Can also be dynamically specified in the code:

Configuration cfg = new Configuration().addResource("Person.hbm.xml").configure();


A change in 4.Hibernate4:

serviceRegistry = new ServiceRegistryBuilder().applySettings(

cfg.getProperties()).buildServiceRegistry();

sessionFactory = cfg.buildSessionFactory(serviceRegistry);

 

Change the new buildSessionFactory function.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Claude at November 16, 2013 - 10:08 AM