-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Insert problem: java.lang.AbstractMethodError:
PostPosted: Fri Nov 19, 2004 11:31 am 
Newbie

Joined: Wed Sep 01, 2004 5:31 am
Posts: 18
Hey all,

Does anyone have any clue as to what the problem is here. I cant seem to figure it out. I was thinking it might be a problem with the assignment of id value. Earlier I tried using the native id-generator strategy but the result is the same as using identity. Any ideas?

Thankful for any replies. Cheers / A.kikr

PS. Sorry for the long mapping doc. DS.

Hibernate version:
2.1
Mapping documents:
<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class
name="se.salespeople.data.object.Client"
table="client"
proxy="se.salespeople.data.object.Client"
dynamic-update="false"
dynamic-insert="false"
>

<id
name="id"
column="id"
type="int"
>
<generator class="identity">
</generator>
</id>

<property
name="name"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="name"
not-null="true"
/>

<property
name="address"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="address"
/>

<property
name="zipCode"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="zipCode"
/>

<property
name="state"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="state"
/>

<property
name="phone"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="phone"
/>

<property
name="fax"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="fax"
/>

<property
name="www"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="www"
/>

<property
name="notes"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="notes"
/>

<many-to-one
name="parent"
class="se.salespeople.data.object.Client"
cascade="none"
outer-join="auto"
update="true"
insert="true"
access="property"
column="parent_id"
/>

<many-to-one
name="user"
class="se.salespeople.data.object.User"
cascade="none"
outer-join="auto"
update="true"
insert="true"
access="property"
column="user_id"
/>

<property
name="regDate"
type="date"
update="true"
insert="true"
access="property"
column="regDate"
not-null="true"
/>

<property
name="regTime"
type="time"
update="true"
insert="true"
access="property"
column="regTime"
not-null="true"
/>

<many-to-one
name="regByUser"
class="se.salespeople.data.object.User"
cascade="none"
outer-join="auto"
update="true"
insert="true"
access="property"
column="regBy"
/>

<property
name="active"
type="boolean"
update="true"
insert="true"
access="property"
column="active"
not-null="true"
/>

<property
name="parId"
type="integer"
update="true"
insert="true"
access="property"
column="par_id"
/>

<set
name="clientCustom"
table="client_custom"
lazy="true"
inverse="false"
cascade="all"
sort="unsorted"
>

<key
column="client_id"
>
</key>

<composite-element
class="se.salespeople.data.object.ClientCustom"
>

<many-to-one
name="clientField"
class="se.salespeople.data.object.ClientField"
cascade="none"
outer-join="auto"
update="true"
insert="true"
access="property"
column="field_id"
/>

<property
name="value"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="value"
/>

</composite-element>

</set>

<set
name="children"
table="client"
lazy="true"
inverse="false"
cascade="none"
sort="unsorted"
>

<key
column="parent_id"
>
</key>

<one-to-many
class="se.salespeople.data.object.Client"
/>
</set>

<set
name="clientActivities"
table="client_activity"
lazy="true"
inverse="false"
cascade="none"
sort="unsorted"
>

<key
column="client_id"
>
</key>

<one-to-many
class="se.salespeople.data.object.ClientActivity"
/>
</set>

<set
name="contacts"
table="client_contacts"
lazy="true"
inverse="false"
cascade="none"
sort="unsorted"
>

<key
column="client_id"
>
</key>

<one-to-many
class="se.salespeople.data.object.Contact"
/>
</set>

<set
name="clientDocuments"
table="client_documents"
lazy="true"
inverse="false"
cascade="none"
sort="unsorted"
>

<key
column="client_id"
>
</key>

<one-to-many
class="se.salespeople.data.object.ClientDocument"
/>
</set>

<set
name="clientRelations"
table="client_relation"
lazy="true"
inverse="false"
cascade="none"
sort="unsorted"
>

<key
column="client_id"
>
</key>

<one-to-many
class="se.salespeople.data.object.ClientRelation"
/>
</set>

<set
name="clientToRelations"
table="client_relation"
lazy="true"
inverse="false"
cascade="none"
sort="unsorted"
>

<key
column="relatedTo_client_id"
>
</key>

<one-to-many
class="se.salespeople.data.object.ClientRelation"
/>
</set>

<set
name="mail"
table="mail"
lazy="true"
inverse="false"
cascade="none"
sort="unsorted"
>

<key
column="client_id"
>
</key>

<one-to-many
class="se.salespeople.data.object.Mail"
/>
</set>

<set
name="orders"
table="order"
lazy="true"
inverse="false"
cascade="none"
sort="unsorted"
>

<key
column="client_id"
>
</key>

<one-to-many
class="se.salespeople.data.object.Order"
/>
</set>

<set
name="categories"
table="rel_client_category"
lazy="true"
inverse="false"
cascade="all"
sort="unsorted"
>

<key
column="client_id"
>
</key>

<many-to-many
class="se.salespeople.data.object.Category"
column="category_id"
outer-join="auto"
/>

</set>

<set
name="projects"
table="rel_project_client"
lazy="true"
inverse="false"
cascade="all"
sort="unsorted"
>

<key
column="client_id"
>
</key>

<many-to-many
class="se.salespeople.data.object.Project"
column="project_id"
outer-join="auto"
/>

</set>

<set
name="userDefinedObjects"
table="userdefobj"
lazy="true"
inverse="false"
cascade="none"
sort="unsorted"
>

<key
column="client_id"
>
</key>

<one-to-many
class="se.salespeople.data.object.UserDefinedObject"
/>
</set>

<set
name="userDefinedObjects2"
table="userdefobj2"
lazy="true"
inverse="false"
cascade="none"
sort="unsorted"
>

<key
column="client_id"
>
</key>

<one-to-many
class="se.salespeople.data.object.UserDefinedObject2"
/>
</set>

<set
name="documentGroupClientRecipients"
table="document_group_recipient"
lazy="true"
inverse="false"
cascade="none"
sort="unsorted"
>

<key
column="recipient_id"
>
</key>

<one-to-many
class="se.salespeople.data.object.DocumentGroupClientRecipient"
/>
</set>
</class>

</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
net.sf.hibernate.Session hibSession = SessionManager.currentSession();
//SessionManager uses threadlocal to return a session (opens it before it
//returns it)
net.sf.hibernate.Transaction transaction = null;
try
{
transaction = hibSession.beginTransaction();

Client newClient = new Client();
newClient.setRegDate(new Date(System.currentTimeMillis()));
newClient.setRegTime(new java.sql.Time(System.currentTimeMillis()));
newClient.setActive(true);
newClient.setRegByUser((User)hibSession.get(User.class, new Integer(1234)));
hibSession.save(newClient);
transaction.commit();
}
catch(Exception ex)
{
ex.printStackTrace();
transaction.rollback();

}
finally
{
SessionManager.closeSession(hibSession);
//closes session and removes from threadlocal
}
Full stack trace of any exception that occurs:
java.lang.AbstractMethodError: org.apache.commons.dbcp.PoolableConnection.prepareStatement(Ljava/lang/String;I)Ljava/sql/PreparedStatement;

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at net.sf.hibernate.util.GetGeneratedKeysHelper.prepareStatement(GetGeneratedKeysHelper.java:39)

at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:254)

at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:61)

at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:525)

at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:432)

at net.sf.hibernate.impl.ScheduledIdentityInsertion.execute(ScheduledIdentityInsertion.java:29)

at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:932)

at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857)

at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:775)

at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)

at org.apache.jsp.modifyClientServletHibernate_jsp._jspService(modifyClientServletHibernate_jsp.java:315)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)

at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)

at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)

at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)

at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)

at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)

at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)

at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)

at java.lang.Thread.run(Thread.java:536)

Name and version of the database you are using:
MySql
The generated SQL (show_sql=true):
select user0_.id as id0_, user0_.name as name0_, user0_.administrator as administ3_0_, user0_.role_id as role_id0_, user0_.teamLeader as teamLeader0_, user0_.active as active0_ from user user0_ where user0_.id=?
insert into client (name, address, zipCode, state, phone, fax, www, notes, parent_id, user_id, regDate, regTime, regBy, active, par_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)


Top
 Profile  
 
 Post subject: id-generator problem
PostPosted: Fri Nov 19, 2004 12:01 pm 
Newbie

Joined: Wed Sep 01, 2004 5:31 am
Posts: 18
OK, it definately seems to be an id-generator problem but which method should i use if i want hibernate to get the next number after the last one issued by mysql?

Cheers A.kikr


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.