Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.databases > #660
| Date | 2013-12-27 22:34 -0500 |
|---|---|
| From | Arne Vajhøj <arne@vajhoej.dk> |
| Newsgroups | comp.lang.java.databases |
| Subject | Re: JPA: annotations or XML? |
| References | <l8nov9$sq4$1@speranza.aioe.org> <52ba5ad5$0$296$14726298@news.sunsite.dk> <l9ef31$nj4$1@dont-email.me> |
| Message-ID | <52be46d0$0$299$14726298@news.sunsite.dk> (permalink) |
| Organization | SunSITE.dk - Supporting Open source |
On 12/25/2013 6:21 AM, Stanimir Stamenkov wrote:
> 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.
I guess the question is whether it will work without
@MappedSuperclass on the base class.
Arne
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