-->
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.  [ 6 posts ] 
Author Message
 Post subject: Simple(?) question - Annotations
PostPosted: Thu Feb 14, 2008 2:05 pm 
Newbie

Joined: Thu Feb 14, 2008 1:48 pm
Posts: 15
Hi!

I'm using hibernate with annotations.

I have two classes. Player and Club. A Player object has to contain a clubId and a Club object has to contain a list of playerIds.

Additionally a Club object should contain a transient list of players and a Player object should contain a transient Club object.

Each of the Classes has a controller. The controller should have two methods to load a class object. One method simply creates objects without related objects (with only ids of the related objects), the other method additionally loads the related objects.

What in hell do I have to do?

As you see, I'm a greenhorn with hibernate.

A helpful answer would be great!
Thx!

Eventhorizon


Top
 Profile  
 
 Post subject: Re: Simple(?) question - Annotations
PostPosted: Thu Feb 14, 2008 2:30 pm 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
Why do you want to keep a list of IDs instead of actual objects?


Farzad-


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 14, 2008 3:00 pm 
Newbie

Joined: Thu Feb 14, 2008 1:48 pm
Posts: 15
Hi farzad!

Because of sometimes I need a list of players with clubs and sometimes I do not need the club information.

I always want to handle as compact data as possible.

Greetings
EH


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 14, 2008 4:08 pm 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
You could always get the list of objects and for your performance concerns you could use a second level cache. That works nicely and the performance will be surprisingly good.



Farzad-


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 15, 2008 4:31 am 
Newbie

Joined: Thu Feb 14, 2008 1:48 pm
Posts: 15
Okay. I'll try it out.

But initially I will have the following structure:

Club 1-* Player *-* Team *-* Match 1-* Game 1-* Result

So I do not know how the select queries will behave. I told hibernate to fetch a depth-level of 3. In my opinion the actual problem is that I do not really understand how the hibernate engine will handle a lot of such data sets.

For now I will try to create such a database structure with simple hibernate annotations.

I assume that the db-structure hibernate will generate looks as follows:

Club 1-* Player 1-* PlayerTeam *-1 Team 1-* TeamMatch *-1 Match 1-* Game 1-* Result

I would accept any further help in thanks! :-) (<- That does not look like an acceptable english sentence, does it?)

Thx, EH


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 17, 2008 6:17 am 
Newbie

Joined: Thu Feb 14, 2008 1:48 pm
Posts: 15
Okay, made a step forward.

I Have defined all my bean classes and the structure nearly looks like what I expected to look like (have to check this in depth later on).

For my next Problem, I'll create a new topic.


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