java - Hibernate 4.3.5 is not working with Oracle10g Database -


i trying out hibernate 4.3.5 oracle database. during run getting following problem(the same code working fine mysql database).

org.hibernate.engine.jdbc.connections.internal.drivermanagerconnectionproviderimpl configure info: hhh000115: hibernate connection pool size: 20 (min=1) jun 26, 2014 10:35:46 org.hibernate.engine.jdbc.internal.jdbcservicesimpl configure warn: hhh000341: not obtain connection metadata : unsupported feature jun 26, 2014 10:35:46 org.hibernate.engine.jdbc.internal.lobcreatorbuilder usecontextuallobcreation info: hhh000422: disabling contextual lob creation connection null exception in thread "main" java.lang.nullpointerexception @ org.hibernate.engine.jdbc.internal.jdbcservicesimpl.configure(jdbcservicesimpl.java:244) @ org.hibernate.boot.registry.internal.standardserviceregistryimpl.configureservice(standardserviceregistryimpl.java:111) @ org.hibernate.service.internal.abstractserviceregistryimpl.initializeservice(abstractserviceregistryimpl.java:234) @ org.hibernate.service.internal.abstractserviceregistryimpl.getservice(abstractserviceregistryimpl.java:206) @ org.hibernate.cfg.configuration.buildtyperegistrations(configuration.java:1885) @ org.hibernate.cfg.configuration.buildsessionfactory(configuration.java:1843) @ com.cluster.hibernatemain.main(hibernatemain.java:29) 

my code is

hibernate.cfg.xml

   <hibernate-configuration>     <session-factory>     <!-- database connection properties - driver, url, user, password -->         <property name="hibernate.connection.driver_class">oracle.jdbc.driver.oracledriver</property>         <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:xe</property>         <property name="hibernate.connection.username">hr</property>         <property name="hibernate.connection.password">hr</property>         <property name="hibernate.hbm2ddl">create</property>           <!-- org.hibernate.hibernateexception: no currentsessioncontext configured! -->         <property name="hibernate.current_session_context_class">thread</property>          <!-- outputs sql queries, should disabled in production -->         <property name="hibernate.show_sql">true</property>          <!-- dialect required let hibernate know database type, mysql, oracle etc             hibernate 4 automatically figure out dialect database connection metadata -->         <property name="hibernate.dialect">org.hibernate.dialect.oracle10gdialect</property>           <!-- mapping file, can use bean annotations -->         <mapping resource="com\cluster\employee.hbm.xml" />     </session-factory> </hibernate-configuration> 

employee.hbm.xml

<hibernate-mapping>     <class name="com.cluster.employee" table="employee">         <id name="id" type="int">             <column name="id" />             <generator class="increment" />         </id>         <property name="name" type="java.lang.string">             <column name="name" />         </property>         <property name="role" type="java.lang.string">             <column name="role" />         </property>         <property name="inserttime" type="timestamp">             <column name="insert_time" />         </property>     </class> </hibernate-mapping> 

and client code

public class hibernatemain {      public static void main(string[] args) {         employee emp = new employee();         emp.setname("amr");         emp.setrole("president");         emp.setinserttime(new date());         // create sessionfactory hibernate.cfg.xml         configuration configuration = new configuration();         configuration.configure();         system.out.println("hibernate configuration loaded");          serviceregistry serviceregistry = new standardserviceregistrybuilder().applysettings(configuration.getproperties()).build();         system.out.println("hibernate serviceregistry created");          sessionfactory sessionfactory = configuration.buildsessionfactory(serviceregistry);          //get session         session session = sessionfactory.getcurrentsession();           //start transaction         session.begintransaction();         //save model object         session.save(emp);         //commit transaction         session.gettransaction().commit();         system.out.println("employee id="+emp.getid());          //terminate session factory, otherwise program won't end         sessionfactory.close();     }  } 

jars using enter image description here

what thing missing ? in advance.

i solved problem removing ojdbc14.jar , adding ojdbc6.jar. because hibernate 4 using jdbc4.0 implementation not present in ojdbc14.jar implementation present in ojdbc6.jar.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -