aspose file tools*
The moose likes Object Relational Mapping and the fly likes SQL server and hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "SQL server and hibernate" Watch "SQL server and hibernate" New topic
Author

SQL server and hibernate

Dhannya Zacharia
Greenhorn

Joined: Aug 13, 2007
Posts: 12
Hi i am using SQL server 2000 and hibernate. i am not able to insert any data to the database via my application. i am able to do so using a normal java application.

My hibernate.cfg.xml:

<property name="hibernate.connection.driver_class">
com.microsoft.jdbc.sqlserver.SQLServerDriver
</property>
<property name="hibernate.connection.url">
jdbc:microsoft:sqlserver://server name:1433;user=xxx;password=yyy;DatabaseName=DP;SelectMethod=cursor
</property>

<property name="hibernate.connection.pool_size">10</property>

<!-- <property name="current_session_context_class">thread</property> -->


<property name="show_sql">true</property>
<property name="dialect">
org.hibernate.dialect.SQLServerDialect
</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="transaction.flush_before_completion">true</property>


<!-- Mapping files -->



I get the following exception :

javax.servlet.ServletException: could not load an entity: [com.trivium.tdp.hibernate.AdminLogin#hello]
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)


root cause

org.hibernate.exception.GenericJDBCException: could not load an entity: [com.trivium.tdp.hibernate.AdminLogin#hello]
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.loader.Loader.loadEntity(Loader.java:1874)
org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)
org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3042)
org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:395)
org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:375)
org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)
org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:98)
org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
org.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:836)
org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:66)
org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:150)
com.trivium.tdp.hibernate.AdminLogin$$EnhancerByCGLIB$$5dacf83.getPassword()
com.trivium.tdp.struts.action.Login.execute(Login.java:66)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)




can someone help me out in this... i am lost
Dhannya Zacharia
Greenhorn

Joined: Aug 13, 2007
Posts: 12
Hi ,

i solved this problem using the jTDS driver... You need to just add the jTDS.jar file in the lib folder.

things will work fine....
 
jQuery in Action, 2nd edition
 
subject: SQL server and hibernate