Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.databases > #657

JPA: annotations or XML?

Path csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail
From Ricardo Palomaes <rpmdisguise-java@nowhere.com>
Newsgroups comp.lang.java.databases
Subject JPA: annotations or XML?
Date Mon, 16 Dec 2013 21:48:45 +0100
Organization Aioe.org NNTP Server
Lines 34
Message-ID <l8nov9$sq4$1@speranza.aioe.org> (permalink)
NNTP-Posting-Host BJiRR0QronntLED8uysUbg.user.speranza.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-15
Content-Transfer-Encoding 7bit
X-Complaints-To abuse@aioe.org
User-Agent Mozilla/5.0 (X11; Linux i686; rv:26.0) Gecko/20100101 Firefox/26.0 SeaMonkey/2.23
X-Notice Filtered by postfilter v. 0.8.2
Xref csiph.com comp.lang.java.databases:657

Show key headers only | View raw


Hi,

I'm trying to use JPA for the first time in a small to mid Java SE
project (I expect it be around 50,000 lines, comments included).

I've always been against libraries using declarative XML files since I
felt that it added burden and an additional hurdle to use them besides
coding. As result of it, I initially liked very much annotations over
XML files in JPA.

However, I'd like to design the application in such a way that it
could use a local database persistence (now) or one based in
webservices (as a future enhancement). I'm still learning, but it
seems that I should use a DAO pattern. This is not a requirement, but
a "nice to have".

I have two questions:

1) (This may be really naive) I've read that JPA acts in some way as a
DAO layer but, will the JPA architecture keep track of entity object
passing through a "real" DAO layer, used in a context unaware of JPA
(the application GUI classes, for instance) and later returned again
to the JPA through the DAO without too much hassle?

2) Would I be able, by using XML files instead of annotations in JPA,
to keep my POJOs completely clean, 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?

I know the answer to both questions may be "It depends on your code
and design" and "Start coding and later refactor", so I'm just looking
for general advice, not definitive answers.

TIA

Back to comp.lang.java.databases | Previous | NextNext in thread | Find similar


Thread

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