-->
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.  [ 4 posts ] 
Author Message
 Post subject: Using stored procedure to update entity table
PostPosted: Thu Feb 08, 2007 9:01 am 
Newbie

Joined: Mon Feb 05, 2007 11:49 am
Posts: 13
Hello.

I'm working on a system where some objects need to keep history information whenever they are changed.
Their primary key is composed by a number which identify the entity and a version number.
What I would like to do is to configure the persistence layer so that when a user calls versionObject.setSomething() the object's version is incremented and a copy of it's old status is created on it's table.
This is not possible using triggers, becuse inserting in the table during trigger execution causes the trigger tomalfunction.
I believe this could be done if I could redirect the update parameters to a stored procedure and let it do the update.

I'm using Oracle 9i.

This must not be done using any hibernate specific features. JPA compatibility must be assured.

Thanks in advance for any help,

Hugo Oliveira
hugom.oliveira.ext@siemens.com


Top
 Profile  
 
 Post subject: Re: Using stored procedure to update entity table
PostPosted: Fri Feb 09, 2007 3:43 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
fubar wrote:
This must not be done using any hibernate specific features. JPA compatibility must be assured.

It can't be done in a JPA standard way I think. Maybe through entity listeners but that might be a lot of work.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 12, 2007 4:07 am 
Newbie

Joined: Mon Feb 05, 2007 11:49 am
Posts: 13
Hello Emmanuel.

Thanks for clearing it up.

Since JPA doesn't support this, can it be done via Hibernate?

Thanhs again,

Hugo Oliveira
hugom.oliveira.ext@siemens.pt


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 15, 2007 6:40 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
it should be doable by adapting/subclassing the Default*EventListener

I must admit I never tried on this usecase

_________________
Emmanuel


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