-->
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: Disable Sequence Generator in an Insert with Save
PostPosted: Wed Jan 10, 2007 1:47 pm 
Newbie

Joined: Wed Jan 10, 2007 1:40 pm
Posts: 12
I have an object where I populate information with and just use the save option with session - session.save(object). Hibernate uses the oracle sequence generator to populate the primary key to the row entry. The problem is that at times, I want to insert my own primary key and not use the sequence generator. Is there a way to disable the sequence generator from retrieving the next sequence so I can just insert the key that I created?

<hibernate-mapping>
<class name="uchicago.nsit.accts.data.valueobject.DPHeaderVO" table="DX_HEADER" schema="DBAACCTS" lazy="false" >
<id name="controlNumber" >
<column name="CONTROLNUM" />
<generator class="sequence" >
<param name="sequence">SEQ_CTRNO</param>
</generator>
</id>
<property name="explanation" >
<column name="EXPLANATION" length="300" />
</property>
......


The sequence is SEQ_CTRNO.

I can't find anything that will work so help.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 10, 2007 4:41 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
can you just run straight sql command to disable the trigger that is using that sequence then re-enable it hwen you're done

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


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.