aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Doubt on SecondaryTable Annotation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Doubt on SecondaryTable Annotation" Watch "Doubt on SecondaryTable Annotation" New topic
Author

Doubt on SecondaryTable Annotation

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9513
    
    2

Guys,

I fail to understand the use of this Annotation as in theory we could do the same thing with @JoinColumn annotation and the @ManyToOne relationship. TSo why do we need this afteral when we have some other alternativs?


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Ralph Jaus
Ranch Hand

Joined: Apr 27, 2008
Posts: 342
@SecondaryTable enables you, to use fields from a secondary table directly in your entity. That means you need to define just one entity. The other techniques like @OneToOne or @ManyToOne need two entities.

So, if there is no further need for an entity consisting of fields from the secondary table, one might prefer to use @Secondary table.


SCJP 5 (98%) - SCBCD 5 (98%)
Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
Thanks Ralf! [ ] I had not pointed out the obvious!


SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ]
Performance is a compulsion, not a option, if my existence is to be justified.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt on SecondaryTable Annotation