Joined: Wed Oct 22, 2008 1:08 am Posts: 1 Location: Surat, Gujarat, India.
|
Hello,
I am working in J2EE since last 3-4 months. Currently understanding (or i should say it learning) JPA.
As per my knowledge, JPA does not support use of interface(as a persistent attribute) in entity classes. I tried to get information about it, but in vain. Few people suggested to have a look at EclipseLink, but i am against using any vendor specific features.
FOR EXAMPLE--------------------------------------------------
Say Account is interface and SavingAccount and SalaryAccount classes are implementing Account interface.
Then class Client is having Account as a attribute. (named account)
so there will be statements like
private Account account;
public Account getAccount() {.........
public void setAccount(Account act) {.........
How to persist Client class??
----------------------------------------------------------------
And not using interface is bad practice, right?
As Erich Gamma said Program to an interface not to an implementation. Now that is not possible with JPA right?
I got many answer which tells me to use abstract classes . But it is not an option for interface.
So,
Is there any workaround?
What is your approach?
Or
People just accepted it.
-Nachiket
_________________ Objects are more important then classes.
|
|