-->
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: Deactivate generation of one-to-many relations
PostPosted: Tue Jun 13, 2006 6:37 am 
Newbie

Joined: Tue Jun 13, 2006 5:38 am
Posts: 2
Hi

I'm writing a web service which will return the result of a hibernate query, for example a list of Users.
I've used Hibernate Tools to create the classes and mapping files from the existing database.

The problem I have is that Hibernate Tools generates these one-to-many relationships. Normally this is no problem because it is lazy loaded, but when delivering this as the result of a web service all the one-to-many relationships will have to be loaded and transmitted to the client.

This leads to that nearly the entire database will be sent to the client.

Is there a way to tell hibernate tools not to generate one-to-many relations?


Thanks
- Markus


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 13, 2006 3:17 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
2 ways:

in reveng.xml use a <foreign-key name="nameoftheforeignkeyyouwanttocontrol"> <one-to-many exclude="true"/>

OR

write a custom reveng strategy that returns false for excludeForeignKeyAsCollection

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 14, 2006 5:32 am 
Newbie

Joined: Tue Jun 13, 2006 5:38 am
Posts: 2
great, thanks!

i wrote my own reveng strategy class.
but returning false doesn't work, returning true does. that's probably what you meant.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 14, 2006 12:35 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes.

A answer to keep you on your toes....ehm ;)

_________________
Max
Don't forget to rate


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.