-->
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: UserType: insert followed by update statement
PostPosted: Sun May 18, 2008 11:28 am 
Newbie

Joined: Sun May 18, 2008 11:03 am
Posts: 2
I'm using Hibernate 3.2.5 and Oracle 10g JDBC against an Oracle 10g DB.

I'm trying to map a legacy table (currently managed through JDBC based DAO) using Hibernate annotations (no other relations at the moment)

My sample class has two "UserType" members:

1) String[] mapped java.sql.Types.ARRAY

2) Custom object mapped to java.sql.Types.STRUCT

The first one behaves as expected: when creating a new object and setting the member a single Insert statement is run against the database when committing.

The second though always triggers an insert followed by an update statement. Both the insert as well as the update statement contain all columns of the table (incl. the "UserType" columns).

Both UserTypes are immutable.

What can be done to avoid running two statements when committing a record? Or could somebody point me towards an explanation of why this is happening?

I have seen a few other people struggling with this but couldn't find a resolution anywhere.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 19, 2008 7:47 am 
Newbie

Joined: Sun May 18, 2008 11:03 am
Posts: 2
I found my mistake: The UserType triggering the additional update statement incorrectly returned null in the deepCopy() method.


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.