Hibernate version:
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
Debug level Hibernate log excerpt:
How do I map the following?
In my current system I have a class called Link which simply has two attributes (id,name).
id is the primary key in the respective table.
name is what gets displayed .
I reuse the Link concept anytime I need to reference an other object.
eg- link to User
link to Account
My UI tier knows how to interpret this data structure.
I have tried to simplify by omitting everything we dont need.
public class Account {
Link user ;
Link bank;
String no
Double balance.
..
}
public class Link {
String id
String desc
}
SQL-
Select user.id, user.name, bank.id, bank.name ...
from account ,user, bank
where ...
public void constructAccount{
Account acc = new Accout();
acc.setUser( new Link(results.getString(user.id),
results.getString(user.name))
)
acc.setBank( new Link(results.getString(bank.id),
results.getString(bank.name))
)
}
So my question is how do I map this Link concept? The column name changes wrt the Link I need.
I am trying to use Hibernate without changing the existing datastructure and data model so that I can isolate the changes to the DAO tier.
thanks a lot for any input or pointers
|