File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Annotation Table Name VS Entity Name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Annotation Table Name VS Entity Name" Watch "Annotation Table Name VS Entity Name" New topic
Author

Annotation Table Name VS Entity Name

lavnish lalchandani
Ranch Hand

Joined: Feb 28, 2007
Posts: 79
Hi



one can give the DB table name using @Entity (name="") or @Table (name="")
not sure whats the difference between two ??


lavnish.blogspot.com
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31062
    
232

While @Entity takes an optional name, it isn't a table name. It is for the case where you want to refer to the entity using a different name in JP QL queries. @Table's name attribute is the actual table name.

@Table's name is used a lot. @Entitiy's name is much rarer. It is useful if you have two @Entity classes' with the same name and you need a way to differentiate them when running queries.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
lavnish lalchandani
Ranch Hand

Joined: Feb 28, 2007
Posts: 79
got it , thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Annotation Table Name VS Entity Name