openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Toffetti <dto...@yahoo.com.ar>
Subject Re: JPA 3.0
Date Mon, 28 Jun 2010 21:53:01 GMT


Daryl Stultz-2 wrote:
> 
> On Fri, Jun 25, 2010 at 8:46 PM, Daniel Toffetti
> <dtoffe@yahoo.com.ar>wrote:
>>
>>    Some time ago I started a quest for a magic tool,
>>    Thanks in advance for any useful tool or URL I might have missed.
> 
> I don't know exactly what you are looking for, but if you haven't looked
> at it, try Ebean. It's pretty flexible with mixing "ORM queries" with
> raw/native SQL.
> 
> http://www.avaje.org/
> 
> -- 
> Daryl Stultz
> 

    I stumbled on this site a couple of times, it seemed too similar to JPA
then, but now I've taken a closer look at the docs and it seems to have some
good points in favor.
    First, it supports all the JPA annotations so using it is somewhat close
to standards. Second, it implements a different entity lifecycle (but still
within the limits of the JPA spec), so I can have detached entities.
    So perhaps I'm very close to my ideal tool.
    I appreciate very much your help, thanks !!!



Russell Collins wrote:
> 
> I have never tried to use JPA with Stored Procedures so excuse my
> ignorance.  If it is difficult or not available, it would benefit the spec
> if JPA would easily use stored procedures and views just like it uses
> tables.  The only thing I think would need to be added to a marked-up
> Entity Object is something like a stored procedure input annotation. 
> Example:
> 
> @Column(name = "admid", nullable=false, length=10)
> @Id
> @ProcedureInput(procedurename = "sp1" name = "somename1", length =  10)
> @ProcedureInput(procedurename = "sp2" name = "somename2", length =  10)
> private String id;
> 
> Just a suggestion.  Hopefully it can spark some good discussion.
> 

    EclipseLink has some non-standard annotations to help in calling stored
procs:

http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_%28ELUG%29#Using_EclipseLink_JPA_Extensions_for_Stored_Procedure_Query

    They are non-standard but perhaps, being already supported by
EclipseLink, they are considered in a future JPA release.
    The main problem with this is that using stored procedures contradicts
the nature of ORM. An SP can modify some live or cached entities,
invalidating them.
    Now EBean (the library suggested by Daryl), being somewhat different in
regards to native operations in the database, offers some support for
hinting what entities might have changed externally (see ebeans 
user guide, section 9.5), so the tool takes care of cached entities
properly.

    In the end, I believe there are two different philosophies and
attempting to make use of both at the same time can become increasingly
tricky.

Thanks for your help,

Daniel

-- 
View this message in context: http://openjpa.208410.n2.nabble.com/JPA-3-0-tp5036154p5232846.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message