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.
|