-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate is not adding to the DB
PostPosted: Thu Jan 05, 2006 9:49 pm 
Newbie

Joined: Tue Aug 02, 2005 5:04 pm
Posts: 15
I'm using postgres and only the sequence is incremented.

Hibernate version:
3.0.5

Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name="com.x.db.maindb.datatransfer.PenDTO" table="pen">
<id name="id" type="integer">
<column name="id" />
<generator class="sequence" >
<param name="sequence">pen_id_seq</param>
</generator>
</id>
<property name="eventTime" type="timestamp">
<column name="event_time" length="8" not-null="true" />
</property>
....
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
s.save(instance);

Full stack trace of any exception that occurs:
n/a

Name and version of the database you are using:
Postgres v 7.4
The generated SQL (show_sql=true):
Hibernate: select nextval ('pen_id_seq')
Debug level Hibernate log excerpt:
Unable to get this working



So, I see that it is indeed updating the sequence but that's all it does, no errors are reported.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 05, 2006 9:58 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Try flushing the session. And please make use of the code tag (it's my pet peeve).


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 05, 2006 10:15 pm 
Newbie

Joined: Tue Aug 02, 2005 5:04 pm
Posts: 15
tenwit wrote:
Try flushing the session. And please make use of the code tag (it's my pet peeve).


I did that, closed the session _and_ it now uses a transaction object and it works.. thanks.


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