-->
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: Hibernate for Criteria Representation
PostPosted: Sat Nov 14, 2009 6:57 am 
Newbie

Joined: Sat Nov 14, 2009 6:23 am
Posts: 1
Hello community members. I'm new to Hibernate, and I want to know if it's applicable to my needs.

For example, I have two tables:

(1) Person (person_id, name, containing age, height, weight)
1, John, 19 yrs, 5'6", 124 lbs
2, Jim, 18yrs, 5'3", 105 lbs
3 Josh, 19 yrs, 5'7", 130 lbs
4 Jon, 19 yrs, 5'8", 124 lbs

(2) Relationships (person_id1 and person_id2, and the name of their relationship)
1, 2, Friend
3, 4, Uncle
2, 4, Cousin
1, 3, Classmate

Here are my questions:
1. Based on some documents that I have read, I am aware of the database mapping from classes to DB through XML... Is it like saying, if I change the schema of the database like creating another table called Age, and transferring the age field from the Person table to that table... I only have to change the XML Mappings?

2. Is it possible in Hibernate to specify some properties... For example, I have these properties and their definitions (ignore the real-world sense):
a. Young - age < 25
b. Healthy - weight < 200 && height < 5" || weight > 100 && age > 20
c. Friendly - age > 20 && the number of relationship must be greater than 2

Can I store these things... and reuse them later? Can I have them stored in XML?

3. Can I do something like this, given this request in English:
Select all healthy and friendly people

How can I represent it in HQL or using Hibernate... reusing the properties I defined in #2 (if it's possible)

Thank you very much.


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.