-->
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: Mapping files and lazy instantiation of relationships.
PostPosted: Thu Apr 14, 2005 12:38 am 
Newbie

Joined: Wed Apr 13, 2005 8:31 pm
Posts: 1
My question is more about practice and how to implement rather than a specific question. I'm using hibernate with the Spring framework.


I have an object which forms the root of an object graph. This Event object maps to a table in Oracle. Triggers populate this "event" table with information about what has happend in a work flow. When an event occurs one or more, upto three possible foreign keys, may be populated in the event. Information in the event object tells me which relationships will actually have relationships to other objects that the event describes. For instance the Event.triggerType() might indicate that a row in another table, representing a document, had been deleted. In this case, the entry in the DOCID column would be present but the target row, in the document table would have been deleted already.

These other relationships are in two cases, one to one relationships and in one case is a one to many (an event may have many tasks). When I tried to map the relationships, I found that I had exceptions being thrown when the keys had values but the referenced data didn't exist. Because Hibernate was trying to fetch the data from the other tables which didn't exist.



My first attempt to fix the problem was to take the following tact.

<class name="Document" table="HVDocument" lazy="true">

which from my reading of the documentation suggest that a proxy will be used on relationships that involve the Document class. This allows me to fetch the Events and so gets me past my first hurdle.

However, now, in cases when I try to reference the document where I know there is a row in the document table, I get an error message that references the proxy. ( I apologize, I don't have the exact text of the message, I'm posting from home.)

So my general question is. How do I map this situation, what special circumstances do I have to consider and what issues should I be aware of when I use lazy as a class attribute and thus end up with proxies representing my entities.

I've had extensive experience with EOF, and this would be extremely simple in EOF, so I'm just a bit frustrated.


Tony


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.