-->
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.  [ 1 post ] 
Author Message
 Post subject: Custom NULL value for objects in legacy database
PostPosted: Fri Apr 25, 2008 10:47 am 
Newbie

Joined: Mon May 29, 2006 11:57 am
Posts: 2
Hi,

I am working with legacy database. When one object is referencing other, i.e. in @ManyToOne relation, value -1 means that reference to other object is NULL (by default Hibernate is expecting NULL).

Obviously when I try to load such object using Hibernate I am getting error that object with id -1 does not exist. also, when I save such object using hibernate there will be NULL value and legacy system is expecting -1.

What is the best way to make such a database to work with Hibernate?
Ideally I would like Hibernate to treat -1 as NULL on reads and writes i.e. when saving object I would like Hibernate to put -1 when reference to other object is null.

_________________
Jaroslaw


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.