aspose file tools*
The moose likes Object Relational Mapping and the fly likes Reg : two hbm file for one java class........... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Reg : two hbm file for one java class..........." Watch "Reg : two hbm file for one java class..........." New topic
Author

Reg : two hbm file for one java class...........

Barry Van
Greenhorn

Joined: Oct 23, 2008
Posts: 22
Hi All,

I have 2 tables 'A'table, 'B'table, having both same columns.
My question is.. can i use one java file "setter/getter" for both tables like writing 2 hbm files for one java file? is it possible , or ?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

"ecpfriends ecpfriends" please check your private messages.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Reehan Lalkhanwar
Ranch Hand

Joined: Jun 16, 2007
Posts: 106
Yes, its possible.
But why would you have two tables with similar design?


Thank you,
Reehan
Barry Van
Greenhorn

Joined: Oct 23, 2008
Posts: 22
requirement like this one for insert and other for retrieved
can you tell me the code? please?
Reehan Lalkhanwar
Ranch Hand

Joined: Jun 16, 2007
Posts: 106
I pictured you were referring that the two tables: A & B, had similar structure. So you plan to map them in two HBM files.
Then you would be writing just one core mapping class where you would have to declare the variables mapped in the .hbm files along with setter/getter.
Doesn't that mean you would be writing two similar HBM files with same variable names, as the same would be declared in the core class :!:
So what code would you need :?:
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39578
    
  27
"ecpfriends ecpfriends", please do not ignore requests from moderators. Accounts without valid display names are generally closed quickly.


Ping & DNS - updated with new look and Ping home screen widget
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Reg : two hbm file for one java class...........
 
Similar Threads
Joining two unrelated tables
Criteria across multiple tables
MySQL to Oracle
Hibernate association mapping
insert two tables in single action ?