-->
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: Better manner to implement it? (custom id + log table)
PostPosted: Mon Jan 21, 2008 2:12 pm 
Newbie

Joined: Tue Dec 18, 2007 9:15 am
Posts: 14
Using:

Code:
Java 6.0
Hibernate 3.0 core
Annotations
JPA


I have the following issue:

In my app some entities have custom created IDs, that is implemented by IdentifierGenerator interface. And I have a EntityListener configured too. This listener will persist or merge rows from a "log table", no problem at way, but my problem occours when the EntityListener try to gets id to store information at log table, but in this moment ID is not avaliable because hibernate have not raised custom ID class.

Client - an entity
CustomID - an IdentifierGenerator class implementation (generate custom ID´s)
LogTable - a class that is an EntityListener.

When I execute the app the following order appear:

- Client (some datas are filled)
- LogTable (this is the second one called)
- CustomID (the ID is called when log table was called before).

How to fix it? Thanks all for patience.

_________________
-= DUNKELHEIT =-


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 21, 2008 2:58 pm 
Newbie

Joined: Tue Dec 18, 2007 9:15 am
Posts: 14
Fixed it using thus:

Put the @Pre... annotation away
and I changed to @Post. So my generator custom ID is called before it´s calling log table to persist.

_________________
-= DUNKELHEIT =-


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.