Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.databases > #659
| From | Stanimir Stamenkov <s7an10@netscape.net> |
|---|---|
| Newsgroups | comp.lang.java.databases |
| Subject | Re: JPA: annotations or XML? |
| Date | 2013-12-25 13:21 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <l9ef31$nj4$1@dont-email.me> (permalink) |
| References | <l8nov9$sq4$1@speranza.aioe.org> <52ba5ad5$0$296$14726298@news.sunsite.dk> |
Tue, 24 Dec 2013 23:11:01 -0500, /Arne Vajhøj/:
> On 12/16/2013 3:48 PM, Ricardo Palomaes wrote:
>
>> so I could use them in both JPA and
>> webservice persistence providers in a DAO architecture, with the web
>> service part not having to include any package from JPA?
>
> Having JPA annotation on classes used outside DAL is a bit ugly.
>
> An alternative approach is to have both real data classes and DTO
> classes. But that duplicate some code.
May be one could use internally a subclass for the sole purpose of
declaring:
@Entity
@AttributeOverrides({
@AttributeOverride(name="foo", column=@Column("FUN")),
...
})
@AssociationOverrides({
@AssociationOverride(name="bar", joinColumns=@JoinColumn("BAR_ID")),
...
})
public class MyDatabaseEntity extends MyBean {
// Nothing in here.
}
Haven't tried it, though.
--
Stanimir
Back to comp.lang.java.databases | Previous | Next — Previous in thread | Next in thread | Find similar
JPA: annotations or XML? Ricardo Palomaes <rpmdisguise-java@nowhere.com> - 2013-12-16 21:48 +0100
Re: JPA: annotations or XML? Arne Vajhøj <arne@vajhoej.dk> - 2013-12-24 23:11 -0500
Re: JPA: annotations or XML? Stanimir Stamenkov <s7an10@netscape.net> - 2013-12-25 13:21 +0200
Re: JPA: annotations or XML? Arne Vajhøj <arne@vajhoej.dk> - 2013-12-27 22:34 -0500
Re: JPA: annotations or XML? Stanimir Stamenkov <s7an10@netscape.net> - 2014-01-02 11:31 +0200
csiph-web