-->
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.  [ 13 posts ] 
Author Message
 Post subject: Problem with inserting row containing identity
PostPosted: Thu Jul 09, 2009 10:46 am 
Newbie

Joined: Thu Jul 09, 2009 9:35 am
Posts: 6
Hi all,
I'm currently trying to insert a row that is defined as identity in DB2.
I get no exception but the row is not inserted.

I'm using hibernate 3.2.2.ga and DB2 9.5

here's the mapping:
<code>
<hibernate-mapping package="com.desj.visa.app.atu.beans" schema="ATU">

<class name="EtatTravail" table="TETATTRAVAIL">
<id name="etatTravailID" type="long" column="IDETATTRAVAIL" unsaved-value="0">
<generator class="identity" />
</id>
<property name="uniteTravail" type="string" column="UNITETRAVAIL"/>
<property name="originatorId" type="string" column="ORIGINATORID"/>
<property name="nomFichier" type="string" column="NOMFICHIERTRAVAIL"/>
<property name="statut" column="ETAT">
<type name="com.desj.visa.app.atu.beans.GenericEnumUserType">
<param name="enumClassName">com.desj.visa.app.atu.beans.Statut</param>
</type>
</property>
<property name="uniqueId" type="timestamp" column="UNIQUEID"/>
<property name="majTimestamp" type="timestamp" column="MAJTIMESTAMP"/>
</class>

</hibernate-mapping>
</code>

My test :
<code>
public void testInsererLog() {
try {
UniteTravailLog uniteLog = new UniteTravailLog();
uniteLog.setDateHeure(new Timestamp(System.currentTimeMillis()));
uniteLog.setMessage("MESSAGE");
uniteLog.setOriginatorId("TESTPB");
uniteLog.setUniqueId(new Timestamp(System.currentTimeMillis()));
dao.ajouterLog(uniteLog);
} catch (Exception ex) {
System.out.println(ex.getMessage());
fail();
}
}
</code>

logging:

Hibernate:
insert
into
ATU.ORIGINATORLOG
(MESSAGE, ORIGINATORID, UNIQUEID, DATEHEURE)
values
(?, ?, ?, ?)


Top
 Profile  
 
 Post subject: Re: Problem with inserting row containing identity
PostPosted: Thu Jul 09, 2009 11:04 am 
Newbie

Joined: Thu Jul 09, 2009 9:35 am
Posts: 6
Changed to Hibernate 3.3.2 and updated my slf4j jars and got the following exception:
Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]


Top
 Profile  
 
 Post subject: Re: Problem with inserting row containing identity
PostPosted: Wed Jul 22, 2009 6:28 am 
Newbie

Joined: Wed Jul 22, 2009 6:19 am
Posts: 2
Hi! I've got the same problem sometimes when trying to access my application. It doesn't happen all the time, but frecuently. The error message is this:

javax.servlet.ServletException: org.hibernate.SessionException: Error! Please, check your JDBC/JDNI Configurations and Database Server avaliability.
Could not open or put a Hibernate Session in ValueStack: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)

I'm using hibernate 3.3.2.GA too.
Any idea of how can I fix it?

Thanks!


Top
 Profile  
 
 Post subject: Re: Problem with inserting row containing identity
PostPosted: Wed Jul 29, 2009 9:25 pm 
Newbie

Joined: Wed Jul 29, 2009 9:19 pm
Posts: 2
patPatate wrote:
Changed to Hibernate 3.3.2 and updated my slf4j jars and got the following exception:
Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]


I ran into the same error. I tried to use a <component>. Using the same class as a <property-id> worked fine, but using a component I got this error. When I open the hibernate JAR it's there though.

At the very least there's inadequate error-reporting here. But it may simply be a bug.

Mark


Top
 Profile  
 
 Post subject: Re: Problem with inserting row containing identity
PostPosted: Tue Sep 01, 2009 1:13 pm 
Newbie

Joined: Tue Sep 01, 2009 6:01 am
Posts: 1
Guys,

If i am correct
Could not open or put a Hibernate Session in ValueStack: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]

This error can be overcome by adding JavaAssist jar file to the classpath will resolve this error.

I could reproduce this just by removing the javaAssist.jar from my project's classpath.

Please correct me if anything wrong.

Srikanth R


Top
 Profile  
 
 Post subject: Re: Problem with inserting row containing identity
PostPosted: Tue Sep 01, 2009 2:49 pm 
Newbie

Joined: Wed Jul 29, 2009 9:19 pm
Posts: 2
I don't know. I managed to 'resolve' this problem by replacing the 3.2 library with a 3.1 library.


Top
 Profile  
 
 Post subject: Re: Problem with inserting row containing identity
PostPosted: Tue Dec 08, 2009 4:28 am 
Newbie

Joined: Tue Dec 08, 2009 4:23 am
Posts: 1
hi,
I'm using hibernate with spring, and I also got the errorMessage: Unable to instantiate default tuplizer org.hibernate.tuple.entity.PojoEntityTuplizer by trying to run a small unit test on my db layer

I already integrated the javassist.jar into my buildpath

any ideas what the problem could be?


Top
 Profile  
 
 Post subject: Re: Problem with inserting row containing identity
PostPosted: Wed Apr 28, 2010 1:18 am 
Newbie

Joined: Wed Apr 28, 2010 1:16 am
Posts: 1
1) check whether any typo mistake on Access Method for all properties

2) if you are using annotation and there is a getter method which do not need to persist with database , annotate it with @Transient


Top
 Profile  
 
 Post subject: Re: Problem with inserting row containing identity
PostPosted: Wed Aug 18, 2010 12:53 am 
Newbie

Joined: Wed Aug 18, 2010 12:45 am
Posts: 1
Thank you all.

I faced the same problem. Just added javassist.jar to classpath and it got resolved.

Regards,
Karthik


Top
 Profile  
 
 Post subject: Re: Problem with inserting row containing identity
PostPosted: Wed Nov 24, 2010 8:35 am 
Newbie

Joined: Wed May 28, 2008 3:56 pm
Posts: 18
This post was a saver....
Adding javassist.jar fixed my prob.


Top
 Profile  
 
 Post subject: Re: Problem with inserting row containing identity
PostPosted: Sat May 07, 2011 10:04 am 
Newbie

Joined: Thu Dec 16, 2010 5:04 pm
Posts: 4
leekiangiap wrote:
1) check whether any typo mistake on Access Method for all properties

2) if you are using annotation and there is a getter method which do not need to persist with database , annotate it with @Transient


Thanks add getter-setter to my POJO class(hibernate dao class) solve my problem. I add new foreign key relation and it works fine now.


Top
 Profile  
 
 Post subject: Re: Problem with inserting row containing identity
PostPosted: Fri Sep 23, 2011 1:11 am 
Newbie

Joined: Fri Sep 23, 2011 1:03 am
Posts: 2
Hi Guys..... I need some help..
I've got this ERROR... I'm doing Struts2 Hibernate.... i need ur help ASAP....

Wer have I gone wrong??
I've put these JAR files...

antlr-2.7.6.jar
commons-collections-3.1.jar
commons-fileupload-1.2.1.jar
commons-io-1.3.2.jar
commons-lang-2.3.jar
commons-logging-1.1.jar
dom4j-1.6.1.jar
ejb3-persistence.jar
freemarker-2.3.13.jar
hibernate3.jar
hibernate-annotations.jar
hibernate-commons-annotations.jar
hibernate-validator.jar
hsqldb.jar
javassist-3.4.ga.jar
javassist-3.9.0.GA.jar
jta-1.1.jar
junit-3.8.1.jar
log4j-1.2.15.jar
ognl-2.6.11.jar
slf4j-api-1.5.8.jar
slf4j-log4j12-1.5.8.jar
struts2-convention-plugin-2.1.6.jar
struts2-core-2.1.6.jar
struts2-fullhibernatecore-plugin-1.4-GA.jar
xwork-2.1.2.jar


Even after that I still get these errors...


org.hibernate.SessionException: Error! Please, check your JDBC/JDNI Configurations and Database Server avaliability.
Could not open or put a Hibernate Session in ValueStack: Could not parse configuration: /hibernate.cfg.xml
com.googlecode.s2hibernate.struts2.plugin.interceptors.SessionTransactionInjectorInterceptor.intercept(SessionTransactionInjectorInterceptor.java:134)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76)



This is my hibernate.cfg.xml

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration SYSTEM
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="hibernate.connection.driver_class">
com.mysql.jdbc.Driver
</property>

<!-- Assume test is the database name -->
<property name="hibernate.connection.url">
jdbc:mysql://172.16.5.51/training
</property>
<property name="hibernate.connection.username">
guest
</property>
<property name="hibernate.connection.password">
guest
</property>

<!-- List of XML mapping files -->
<mapping resource="User.hbm.xml"/>

</session-factory>
</hibernate-configuration>


I'm using MySQL


Top
 Profile  
 
 Post subject: NOT Connecting with BD
PostPosted: Fri Sep 23, 2011 1:13 am 
Newbie

Joined: Fri Sep 23, 2011 1:03 am
Posts: 2
Hi Guys..... I need some help..
I've got this ERROR... I'm doing Struts2 Hibernate.... i need ur help ASAP....

Wer have I gone wrong??
I've put these JAR files...

antlr-2.7.6.jar
commons-collections-3.1.jar
commons-fileupload-1.2.1.jar
commons-io-1.3.2.jar
commons-lang-2.3.jar
commons-logging-1.1.jar
dom4j-1.6.1.jar
ejb3-persistence.jar
freemarker-2.3.13.jar
hibernate3.jar
hibernate-annotations.jar
hibernate-commons-annotations.jar
hibernate-validator.jar
hsqldb.jar
javassist-3.4.ga.jar
javassist-3.9.0.GA.jar
jta-1.1.jar
junit-3.8.1.jar
log4j-1.2.15.jar
ognl-2.6.11.jar
slf4j-api-1.5.8.jar
slf4j-log4j12-1.5.8.jar
struts2-convention-plugin-2.1.6.jar
struts2-core-2.1.6.jar
struts2-fullhibernatecore-plugin-1.4-GA.jar
xwork-2.1.2.jar


Even after that I still get these errors...


org.hibernate.SessionException: Error! Please, check your JDBC/JDNI Configurations and Database Server avaliability.
Could not open or put a Hibernate Session in ValueStack: Could not parse configuration: /hibernate.cfg.xml
com.googlecode.s2hibernate.struts2.plugin.interceptors.SessionTransactionInjectorInterceptor.intercept(SessionTransactionInjectorInterceptor.java:134)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468)
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76)



This is my hibernate.cfg.xml

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration SYSTEM
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="hibernate.connection.driver_class">
com.mysql.jdbc.Driver
</property>

<!-- Assume test is the database name -->
<property name="hibernate.connection.url">
jdbc:mysql://172.16.5.51/training
</property>
<property name="hibernate.connection.username">
guest
</property>
<property name="hibernate.connection.password">
guest
</property>

<!-- List of XML mapping files -->
<mapping resource="User.hbm.xml"/>

</session-factory>
</hibernate-configuration>


I'm using MySQL


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 13 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.