-->
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: Multiple @Entity - Multiple tables single pojo
PostPosted: Mon Aug 30, 2010 12:43 pm 
Newbie

Joined: Fri Aug 13, 2010 12:49 am
Posts: 3
Hi

I am facing an issue regarding mapping a single pojo to two tables. The sample tables are as follows:
Code:
[b][u]Table1[/u][/b]
Col1Id
Col2
Col3

[b][u]Table2[/u][/b]
ColA
ColB
ColC


I would like to map these tables something like this:
Code:
@Entity(name="read")
@Entity(name="write")
@Table(name = "table1")
public class class1 {

@Column() --- specify entity type "read"
col1
@Column() --- specify entity type "read"
col2
@Column() --- specify entity type "read"
col3

@Column() --- specify entity type "write"
colA
@Column() --- specify entity type "write"
colB
@Column() --- specify entity type "write"
colC
}


This seems to be easy to be done using hbm file using entity-name. Please let me know how I could attain the same using annotations & How do i map the columns to a particular annotation. I am referring to Hibernate 3


Top
 Profile  
 
 Post subject: Re: Multiple @Entity - Multiple tables single pojo
PostPosted: Tue Aug 31, 2010 1:05 am 
Regular
Regular

Joined: Fri Aug 06, 2010 1:49 am
Posts: 102
Location: shynate26@gmail.com
Might be useful.

viewtopic.php?t=992246


Top
 Profile  
 
 Post subject: Re: Multiple @Entity - Multiple tables single pojo
PostPosted: Tue Aug 31, 2010 2:01 am 
Newbie

Joined: Fri Aug 13, 2010 12:49 am
Posts: 3
Thanks Shynate!

The solution provided in the link that u pointed to does not help me in providing multiple Entity names. Could someone please point me, how I could implement entity-name equivalent in annotations?

Also, what is the equivalent for @SecondaryTable in xml notation? How do I acheive the @SecondaryTable's function in xml(hbm) implementation without annotation?


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.