|
Replies:
2
-
Last Post:
Mar 23, 2009 1:07 AM
by: Kristian Rink
|
|
|
|
|
|
|
persistence recommendations for EJB apps?
Posted:
Mar 20, 2009 1:42 AM
|
|
|
Folks;
in an EJB application I need to utilize SQL backend persistence in a way that allows for retrieving data in a pretty "plain" way - either returning Map<String,String> data if just one table row has been SELECTed, or List<Map<String,String>> if more than one table row has been SELECTed, with the column names in the corresponding table being keys of the Map and the content of the corresponding cells in this row/cell. This kind of data access should happen from within a stateless session bean exposing something DAO'ish to the rest of the application structure.
There are three technologies in question for me to choose from in order to solve this issue:
- The SimpleJdbcTemplate helper class of Spring Framework provides a facility doing right this kind of data query, and this is what I am using in a prototype right now because we so far still use Spring in other parts of our application. Aiming for EJB3 however, I would like to keep dependencies slim which is not what really is happening throwing in Spring.
- JPA and EntityManager, which would be my preferred approach (as it is stock Java EE technology and we need O/R features as well in another, "new" part of our application), seems to have functionality to do native SQL queries returning Object's or Object[]s containing the "plain" table content but not the table column names so it is just half of what I need at the moment. So in here, I definitely would need some tweaking to make things work the way they should.
- Using plain JDBC, which is simply around, eventually would address this task at the cost of having to deal with pretty much "low-level" JDBC stuff like connections et al so this is not really what I would like to go for but eventually would do if anything else failed.
So, I am unsure whether to stay with the Spring helper code here, use JPA and eventually some additional glue or throw away most of these dependencies using just JDBC for this mess? Comments, anyone?
TIA and all the best, Kristian
-- Kristian Rink cell : +49 176 2447 2771 business: http://www.planconnect.de personal: http://pictorial.zimmer428.net "Past midnight. Never knew such silence. The earth might be uninhabited..." //beckett / krapp's last tape//
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net For additional commands, e-mail: users-help@glassfish.dev.java.net
|
|
|
|
|
|
|
|
|
Re: persistence recommendations for EJB apps?
Posted:
Mar 23, 2009 1:07 AM
in response to: frank_martinez
|
|
|
Hi there;
and first off, thanks a bunch for your feedback on that.
glassfish@javadesktop.org schrieb: > Use Apache iBatis : http://ibatis.apache.org/ > It allows you to retrieve a List of Map objects from a query.
Yeah, I already stumbled across iBatis a couple of days ago but so far hesitated throwing it in as it again adds a "new set of dependency" which I initially wanted to avoid (in favour of JPA or something which is already there). But seems there'll always be a price to pay... 
Thanks and best, Kristian
-- Kristian Rink cell : +49 176 2447 2771 business: http://www.planconnect.de personal: http://pictorial.zimmer428.net "Past midnight. Never knew such silence. The earth might be uninhabited..." //beckett / krapp's last tape//
--------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net For additional commands, e-mail: users-help@glassfish.dev.java.net
|
|
|
|
|