-->
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.  [ 10 posts ] 
Author Message
 Post subject: summary information
PostPosted: Mon May 03, 2004 1:16 am 
Newbie

Joined: Mon May 03, 2004 1:08 am
Posts: 18
I have a webform where I need to show data from Several tables.
Employee, Department, LastPromotionDate,

LastPromotionDate is obtained from Promotion table (emp#, promotion, rank)
In addition there is a Dependent table(emp#, dependentssn)
Their is a claim table (dependentSSN, Claim#)


I need to be able to search on claim# and retrieve employees.


How do I map this ?
In Hibernate can I retrieve only selected columns.
In this case I need to return an EmployeeWebObject (EMP#,Department#,LastPromotionDate) (Note I need summary information from several tables)


Please help


Top
 Profile  
 
 Post subject: Is this not possible?
PostPosted: Mon May 03, 2004 10:35 am 
Newbie

Joined: Mon May 03, 2004 1:08 am
Posts: 18
Help.
Is it even possible to map a value Object for the web ?
thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 03, 2004 10:41 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
We don't know what you want, but it seems you haven't read any documentation.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 03, 2004 10:53 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
i think what he wants is a partial "view" of the object graph,
what is commonly called DTO,
what has been already discussed thousand times in the forum,
what is generally rejected by the community but also
what is used by many companies.
:(


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 03, 2004 10:54 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
So, whats the problem? "select new MyDTO(propertyA, propertyB, etc) from Foo"

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 03, 2004 10:57 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
hey, I've no problem lol, i think the post wasn't clear... just wanna help...


Top
 Profile  
 
 Post subject: Please clarify
PostPosted: Mon May 03, 2004 10:58 am 
Newbie

Joined: Mon May 03, 2004 1:08 am
Posts: 18
I apologize I am not very familiar with Hibernate and am trying to move our custom JDBC which is used for the web tier (DTO technology ) to use Hibernate .
Please let me know if this possible to do using Hibernate .
If so any pointers to the right place will help me out tremendously.


Thanks again


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 03, 2004 11:00 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
DTO is not a technology lol

1- you must think about a REAL domain model.
2- Then read carefully at least 3 times the doc
3- for porting use the example given by christian to "generate" dynamically the DTO your views need...

But it is possible.
Don't forget to understand the "persistence" aspect of hibernate, you'll see it's very powerfull.

Anthony


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 03, 2004 11:12 am 
Newbie

Joined: Mon May 03, 2004 1:08 am
Posts: 18
Table
Employee (ssn, name,deptname, city, current salary, last_promotion_id)
Dept(deptname, description)
Dependents(dependent ssn, employee_ssn, dependent name )
Promotion(promotion_id, ssn, promotitle,promodate)
Claims(claim_no, dependentssn)

Firstcolumn in every table is primary key

Employee my have 0..* Dependents
Dependents may have 0..* claims
Employee may have 1..* promotions



Given the above what I want in my DTO given one employee ssn is a query that returns EmployeeDTO with the following
Employee.SSN
Employee.name
Employee.Deptname
Promotion.promotitle (joined employee.last_promotion_id = promotion_id)



The second part of my question is I still need EmployeeDTD but my search criteria is claim_no.. like the sql below

select .Employee.SSN,Employee.Deptname,Promotion.promotitle
where ...
and exists ( select .. from claim , dependents
where emp.ssn= dependends.employee_ssn
and dependends.employee_ssn= claim.dependentssn)


Top
 Profile  
 
 Post subject: help please
PostPosted: Mon May 03, 2004 8:27 pm 
Newbie

Joined: Mon May 03, 2004 1:08 am
Posts: 18
Is this possible? what will the mapping look like .
Is the query above possible


If there is a better alternative please let me know.


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