-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate and MySQL Views
PostPosted: Wed Nov 02, 2011 5:56 am 
Newbie

Joined: Wed Feb 24, 2010 1:05 pm
Posts: 5
Location: India
Hi I have a view that contains the following data.
Code:
+---------+-------------+----------+
| team_id | cust_type   | count(*) |
+---------+-------------+----------+
|       2 | Account     |       12 |
|       2 | Lead        |       13 |
|       2 | Opportunity |        5 |
|       2 | Others      |        1 |
|       2 | Partner     |       16 |
|       2 | PO          |        5 |
|       2 | Prospect    |        8 |
|       2 | Reseller    |        7 |
|       3 | Account     |       25 |
|       3 | OC          |        1 |
|       3 | Partner     |        3 |
|       3 | Prospect    |        9 |
|       4 | Account     |        4 |
|       5 | Account     |        6 |
|       5 | Opportunity |        1 |
|       5 | Prospect    |        8 |
+---------+-------------+----------+


I want to map this to Hibernate entity. The first column 'Team_id' is not unique. Hence how can I write the mapping entries for this?
Any idea?

Thanks in advance


Top
 Profile  
 
 Post subject: Re: Hibernate and MySQL Views
PostPosted: Thu Nov 03, 2011 6:01 am 
Senior
Senior

Joined: Tue Oct 28, 2008 10:39 am
Posts: 196
Is team_id + cust_type unique? If so, create an ID-class with those two columns. And rename the third column for better readability.


Top
 Profile  
 
 Post subject: Re: Hibernate and MySQL Views
PostPosted: Thu Nov 03, 2011 6:09 am 
Newbie

Joined: Wed Feb 24, 2010 1:05 pm
Posts: 5
Location: India
CDillinger wrote:
Is team_id + cust_type unique? If so, create an ID-class with those two columns. And rename the third column for better readability.


team_id and cust_type is unique.
Thanks man. will try and let you know.


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