-->
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: No insert when adding new joined-subclass object
PostPosted: Tue Aug 02, 2005 5:18 pm 
Newbie

Joined: Tue Aug 02, 2005 5:04 pm
Posts: 15
When I add an object of the subclass it increments the sequence but no rows are inserted. Generated SQL is:

select nextval ('saccount')


Any help is appreciated.

Info:

Hibernate version:
v2 (believe 2.1.8)

Mapping documents:
<class
name="com.x.commons.datatransfer.AccountDTO"
table="account"
>
<id
name="id"
type="int"
column="id">
<generator class="native">
<param name="sequence">saccount</param>
</generator>
</id>

<property name="login"
type="java.lang.String" />
<property name="firstName" column="first_name"
type="java.lang.String" />
<property name="lastName" column="last_name"
type="java.lang.String" />

<joined-subclass
name="com.x.commons.datatransfer.AccountMerchantDTO"
table="account_merchant"
>

<key column="account_id"></key>

<!-- bi-directional many-to-one association to merchant -->
<many-to-one
name="merchant"
class="com.x.commons.datatransfer.MerchantDTO"
>
<column name="merchant_id" />
</many-to-one>

</joined-subclass>
</class>

Code between sessionFactory.openSession() and session.close():

avDTO = new AccountMerchantDTO();
avDTO.setLogin("abc");
avDTO.setFirstName("fdfd");
avDTO.setLastName("fdsfdssfd");
avDTO.setMerchant(merchant); // merchant object set somewhere else
session.save(avDTO);

Full stack trace of any exception that occurs:

none

Name and version of the database you are using:

postgres v7.4

The generated SQL (show_sql=true):

Hibernate: select nextval ('saccount')

Debug level Hibernate log excerpt:

Due to log4j problems I couldn't get this despite hours trying, but I could try more if this is necessary.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 02, 2005 6:18 pm 
Newbie

Joined: Tue Aug 02, 2005 5:04 pm
Posts: 15
Figured it out - I wasn't doing the .save() within a transaction.

(Can I have my point back? Just kidding).


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.