Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.databases > #657
| From | Ricardo Palomaes <rpmdisguise-java@nowhere.com> |
|---|---|
| Newsgroups | comp.lang.java.databases |
| Subject | JPA: annotations or XML? |
| Date | 2013-12-16 21:48 +0100 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <l8nov9$sq4$1@speranza.aioe.org> (permalink) |
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 | Next — 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