You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by mauro2java2011 <ma...@gmail.com> on 2013/09/24 10:59:19 UTC

Hibernate Vs OpenJPA

I know that OpenJPA weaving entity statically or dinamitically with a java
agent true ??????


I make 3 ask :

1) HIbernate not weave the entities??? 
OR what mechanosme it use ????

2) If i use a project client that make call remote at a tomee application
and i get entities like value return of EJb methods , i have to have into
classpath of client the entities weave. 
SO how i can get statically the entities at build time with netbeans ? for
incluede it int othe client project .

3) With hibernate is not  mandatory  weaving entity ? SO i can compile
without weaving entity for place into the classpath of client ?





--
View this message in context: http://openejb.979440.n4.nabble.com/Hibernate-Vs-OpenJPA-tp4665234.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Hibernate Vs OpenJPA

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Why do you use a car of a branch and not from another? just because
features are slightly differents but noone is best than the other. JPA spec
relies on enhancement. Hibernate use a correct default without enhancement
but loose because of it some features.

Advantages depends on:
1) team
2) application
3) usage (lib/final app/other...)

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/9/24 mauro2java2011 <ma...@gmail.com>

> 1) so into hibernate bytes [] iti s eager loading??
>
> 2)But if hibernate not use weaving, whi OpenJPA and Eclipse-link use
> weaving??
>
> 3) What then  is the advantage of using  OpenJPA or Eclipse-link instead of
> hibernate?
> In my opinion only complicate things ...
>
>
>
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Hibernate-Vs-OpenJPA-tp4665234p4665251.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: Hibernate Vs OpenJPA

Posted by mauro2java2011 <ma...@gmail.com>.
tank you for responses .

Il giorno mar, 24/09/2013 alle 07.10 -0700, Mark Struberg [via OpenEJB]
ha scritto:
> In Hibernate 
> 
> @Basic(fetchType=LAZY) 
> byte[] image; 
> 
> public byte [] getImage() {return image;} 
> 
> in OpenJPA and eclipselink you will get some 'enhance' classes which
> will do kind of 
> 
> byte[] image; 
> public byte[] getImage() { 
>   if (!imageLoaded()) { 
>    image = loadImage(); 
>   } 
>   return image; 
> 
> } 
> 
> 
> Means in OpenJPA and EclipseLink, lazy loading does work. In Hibernate
> it does not. 
> 
> A few years ago I wrote a blog post about it [1]. Maybe this helps. 
> 
> 
> LieGrue, 
> strub 
> 
> [1]
> http://struberg.wordpress.com/2012/01/08/jpa-enhancement-done-right/
> 
> 
> 
> 
> 
> >________________________________ 
> > From: mauro2java2011 <[hidden email]> 
> >To: [hidden email] 
> >Sent: Tuesday, 24 September 2013, 14:49 
> >Subject: Re: Hibernate Vs OpenJPA 
> > 
> > 
> >1) so into hibernate bytes [] iti s eager loading?? 
> > 
> >2)But if hibernate not use weaving, whi OpenJPA and Eclipse-link use 
> >weaving?? 
> > 
> >3) What then  is the advantage of using  OpenJPA or Eclipse-link
> instead of 
> >hibernate? 
> >In my opinion only complicate things ... 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >-- 
> >View this message in context:
> http://openejb.979440.n4.nabble.com/Hibernate-Vs-OpenJPA-tp4665234p4665251.html
> >Sent from the OpenEJB User mailing list archive at Nabble.com. 
> > 
> > 
> > 
> 
> 
> 
> 
> ______________________________________________________________________
> If you reply to this email, your message will be added to the
> discussion below:
> http://openejb.979440.n4.nabble.com/Hibernate-Vs-OpenJPA-tp4665234p4665252.html 
> To unsubscribe from Hibernate Vs OpenJPA, click here.
> NAML 






--
View this message in context: http://openejb.979440.n4.nabble.com/Hibernate-Vs-OpenJPA-tp4665234p4665260.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Hibernate Vs OpenJPA

Posted by Mark Struberg <st...@yahoo.de>.
In Hibernate 

@Basic(fetchType=LAZY)
byte[] image;

public byte [] getImage() {return image;}

in OpenJPA and eclipselink you will get some 'enhance' classes which will do kind of

byte[] image;
public byte[] getImage() {
  if (!imageLoaded()) {
   image = loadImage();
  }
  return image;

}


Means in OpenJPA and EclipseLink, lazy loading does work. In Hibernate it does not.

A few years ago I wrote a blog post about it [1]. Maybe this helps.


LieGrue,
strub

[1] http://struberg.wordpress.com/2012/01/08/jpa-enhancement-done-right/





>________________________________
> From: mauro2java2011 <ma...@gmail.com>
>To: users@openejb.apache.org 
>Sent: Tuesday, 24 September 2013, 14:49
>Subject: Re: Hibernate Vs OpenJPA
> 
>
>1) so into hibernate bytes [] iti s eager loading??
>
>2)But if hibernate not use weaving, whi OpenJPA and Eclipse-link use
>weaving??
>
>3) What then  is the advantage of using  OpenJPA or Eclipse-link instead of
>hibernate?
>In my opinion only complicate things ...
>
>
>
>
>
>
>
>--
>View this message in context: http://openejb.979440.n4.nabble.com/Hibernate-Vs-OpenJPA-tp4665234p4665251.html
>Sent from the OpenEJB User mailing list archive at Nabble.com.
>
>
>

Re: Hibernate Vs OpenJPA

Posted by mauro2java2011 <ma...@gmail.com>.
1) so into hibernate bytes [] iti s eager loading??

2)But if hibernate not use weaving, whi OpenJPA and Eclipse-link use
weaving??

3) What then  is the advantage of using  OpenJPA or Eclipse-link instead of
hibernate?
In my opinion only complicate things ...







--
View this message in context: http://openejb.979440.n4.nabble.com/Hibernate-Vs-OpenJPA-tp4665234p4665251.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Hibernate Vs OpenJPA

Posted by Mark Struberg <st...@yahoo.de>.
>>  nothing or weaving too (to support blobs for instance or some lazy loading
>>  on 1-1 IIRC)  ??????????
With hibernate you will by default get native Java objects from the PersistenceManager. Pretty much the only 'special' thing about them is that all Collections are replaced with proxying variants, e.g. (class names are just examples) instead of List<User> you will get a LazyLoadingList<User>. 

Other members like String, byte[] etc will _not_ get some proxies but will be accessed natively.

Please note that this is fine from a JPA spec perspective as the spec defines that LAZY fetching is only a 'hint' to the JPA container, but not a command.

LieGrue,
strub




----- Original Message -----
> From: Romain Manni-Bucau <rm...@gmail.com>
> To: "users@tomee.apache.org" <us...@tomee.apache.org>
> Cc: OpenEJB Users <us...@openejb.apache.org>
> Sent: Tuesday, 24 September 2013, 12:35
> Subject: Re: Hibernate Vs OpenJPA
> 
> one to one relationships
> 
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> *Blog: 
> **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> *Github: https://github.com/rmannibucau*
> 
> 
> 
> 2013/9/24 mauro2java2011 <ma...@gmail.com>
> 
>>  escuse me but i not understand :
>>  -------------------------------------------------------------------
>>  nothing or weaving too (to support blobs for instance or some lazy loading
>>  on 1-1 IIRC)  ??????????
>>  -----------------------------------------------------------
>>  A) escuse me but i not have understand what it is 1-1 IIRC  ......
>> 
>>  B)Without weaving hibernate not support blobs for example or lazy loading ?
>>  Romain Manni-Bucau wrote
>>  > Hi
>>  >
>>  > i answered inline
>>  >
>>  > *Romain Manni-Bucau*
>>  > *Twitter: @rmannibucau &lt;https://twitter.com/rmannibucau>*
>>  > *Blog:
>>  > **
>>  http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
>>  ;
>>  > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
>>  > *Github: https://github.com/rmannibucau*
>>  >
>>  >
>>  >
>>  > 2013/9/24 mauro2java2011 &lt;
>> 
>>  > mauro2java2011@
>> 
>>  > &gt;
>>  >
>>  >> I know that OpenJPA weaving entity statically or dinamitically 
> with a
>>  >> java
>>  >> agent true ??????
>>  >>
>>  >>
>>  >> I make 3 ask :
>>  >>
>>  >> 1) HIbernate not weave the entities???
>>  >> OR what mechanosme it use ????
>>  >>
>>  >
>>  > nothing or weaving too (to support blobs for instance or some lazy
>>  loading
>>  > on 1-1 IIRC)
>>  >
>>  >
>>  >>
>>  >> 2) If i use a project client that make call remote at a tomee
>>  application
>>  >> and i get entities like value return of EJb methods , i have to 
> have
>>  into
>>  >> classpath of client the entities weave.
>>  >> SO how i can get statically the entities at build time with 
> netbeans ?
>>  >> for
>>  >> incluede it int othe client project .
>>  >>
>>  >
>>  > using DTO avoids it otherwise yes cause of serialization mecanisms, on
>>  > trunk you can use another serializer than java default mecanism so it
>>  > would
>>  > solve it
>>  >
>>  >
>>  >>
>>  >> 3) With hibernate is not  mandatory  weaving entity ? SO i can 
> compile
>>  >> without weaving entity for place into the classpath of client ?
>>  >>
>>  >>
>>  >>
>>  > same with openjpa using the javaagent (openejb-javaagent)
>>  >
>>  >
>>  >>
>>  >>
>>  >>
>>  >> --
>>  >> View this message in context:
>>  >> 
> http://openejb.979440.n4.nabble.com/Hibernate-Vs-OpenJPA-tp4665234.html
>>  >> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>  >>
>> 
>> 
>>  Romain Manni-Bucau wrote
>>  > Hi
>>  >
>>  > i answered inline
>>  >
>>  > *Romain Manni-Bucau*
>>  > *Twitter: @rmannibucau &lt;https://twitter.com/rmannibucau>*
>>  > *Blog:
>>  > **
>>  http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
>>  ;
>>  > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
>>  > *Github: https://github.com/rmannibucau*
>>  >
>>  >
>>  >
>>  > 2013/9/24 mauro2java2011 &lt;
>> 
>>  > mauro2java2011@
>> 
>>  > &gt;
>>  >
>>  >> I know that OpenJPA weaving entity statically or dinamitically 
> with a
>>  >> java
>>  >> agent true ??????
>>  >>
>>  >>
>>  >> I make 3 ask :
>>  >>
>>  >> 1) HIbernate not weave the entities???
>>  >> OR what mechanosme it use ????
>>  >>
>>  >
>>  > nothing or weaving too (to support blobs for instance or some lazy
>>  loading
>>  > on 1-1 IIRC)
>>  >
>>  >
>>  >>
>>  >> 2) If i use a project client that make call remote at a tomee
>>  application
>>  >> and i get entities like value return of EJb methods , i have to 
> have
>>  into
>>  >> classpath of client the entities weave.
>>  >> SO how i can get statically the entities at build time with 
> netbeans ?
>>  >> for
>>  >> incluede it int othe client project .
>>  >>
>>  >
>>  > using DTO avoids it otherwise yes cause of serialization mecanisms, on
>>  > trunk you can use another serializer than java default mecanism so it
>>  > would
>>  > solve it
>>  >
>>  >
>>  >>
>>  >> 3) With hibernate is not  mandatory  weaving entity ? SO i can 
> compile
>>  >> without weaving entity for place into the classpath of client ?
>>  >>
>>  >>
>>  >>
>>  > same with openjpa using the javaagent (openejb-javaagent)
>>  >
>>  >
>>  >>
>>  >>
>>  >>
>>  >> --
>>  >> View this message in context:
>>  >> 
> http://openejb.979440.n4.nabble.com/Hibernate-Vs-OpenJPA-tp4665234.html
>>  >> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>  >>
>> 
>> 
>> 
>> 
>> 
>>  --
>>  View this message in context:
>> 
> http://openejb.979440.n4.nabble.com/Hibernate-Vs-OpenJPA-tp4665234p4665240.html
>>  Sent from the OpenEJB User mailing list archive at Nabble.com.
>> 
> 

Re: Hibernate Vs OpenJPA

Posted by Romain Manni-Bucau <rm...@gmail.com>.
one to one relationships

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/9/24 mauro2java2011 <ma...@gmail.com>

> escuse me but i not understand :
> -------------------------------------------------------------------
> nothing or weaving too (to support blobs for instance or some lazy loading
> on 1-1 IIRC)  ??????????
> -----------------------------------------------------------
> A) escuse me but i not have understand what it is 1-1 IIRC  ......
>
> B)Without weaving hibernate not support blobs for example or lazy loading ?
> Romain Manni-Bucau wrote
> > Hi
> >
> > i answered inline
> >
> > *Romain Manni-Bucau*
> > *Twitter: @rmannibucau &lt;https://twitter.com/rmannibucau&gt;*
> > *Blog:
> > **
> http://rmannibucau.wordpress.com/*&lt;http://rmannibucau.wordpress.com/&gt
> ;
> > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> > *Github: https://github.com/rmannibucau*
> >
> >
> >
> > 2013/9/24 mauro2java2011 &lt;
>
> > mauro2java2011@
>
> > &gt;
> >
> >> I know that OpenJPA weaving entity statically or dinamitically with a
> >> java
> >> agent true ??????
> >>
> >>
> >> I make 3 ask :
> >>
> >> 1) HIbernate not weave the entities???
> >> OR what mechanosme it use ????
> >>
> >
> > nothing or weaving too (to support blobs for instance or some lazy
> loading
> > on 1-1 IIRC)
> >
> >
> >>
> >> 2) If i use a project client that make call remote at a tomee
> application
> >> and i get entities like value return of EJb methods , i have to have
> into
> >> classpath of client the entities weave.
> >> SO how i can get statically the entities at build time with netbeans ?
> >> for
> >> incluede it int othe client project .
> >>
> >
> > using DTO avoids it otherwise yes cause of serialization mecanisms, on
> > trunk you can use another serializer than java default mecanism so it
> > would
> > solve it
> >
> >
> >>
> >> 3) With hibernate is not  mandatory  weaving entity ? SO i can compile
> >> without weaving entity for place into the classpath of client ?
> >>
> >>
> >>
> > same with openjpa using the javaagent (openejb-javaagent)
> >
> >
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >> http://openejb.979440.n4.nabble.com/Hibernate-Vs-OpenJPA-tp4665234.html
> >> Sent from the OpenEJB User mailing list archive at Nabble.com.
> >>
>
>
> Romain Manni-Bucau wrote
> > Hi
> >
> > i answered inline
> >
> > *Romain Manni-Bucau*
> > *Twitter: @rmannibucau &lt;https://twitter.com/rmannibucau&gt;*
> > *Blog:
> > **
> http://rmannibucau.wordpress.com/*&lt;http://rmannibucau.wordpress.com/&gt
> ;
> > *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> > *Github: https://github.com/rmannibucau*
> >
> >
> >
> > 2013/9/24 mauro2java2011 &lt;
>
> > mauro2java2011@
>
> > &gt;
> >
> >> I know that OpenJPA weaving entity statically or dinamitically with a
> >> java
> >> agent true ??????
> >>
> >>
> >> I make 3 ask :
> >>
> >> 1) HIbernate not weave the entities???
> >> OR what mechanosme it use ????
> >>
> >
> > nothing or weaving too (to support blobs for instance or some lazy
> loading
> > on 1-1 IIRC)
> >
> >
> >>
> >> 2) If i use a project client that make call remote at a tomee
> application
> >> and i get entities like value return of EJb methods , i have to have
> into
> >> classpath of client the entities weave.
> >> SO how i can get statically the entities at build time with netbeans ?
> >> for
> >> incluede it int othe client project .
> >>
> >
> > using DTO avoids it otherwise yes cause of serialization mecanisms, on
> > trunk you can use another serializer than java default mecanism so it
> > would
> > solve it
> >
> >
> >>
> >> 3) With hibernate is not  mandatory  weaving entity ? SO i can compile
> >> without weaving entity for place into the classpath of client ?
> >>
> >>
> >>
> > same with openjpa using the javaagent (openejb-javaagent)
> >
> >
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >> http://openejb.979440.n4.nabble.com/Hibernate-Vs-OpenJPA-tp4665234.html
> >> Sent from the OpenEJB User mailing list archive at Nabble.com.
> >>
>
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Hibernate-Vs-OpenJPA-tp4665234p4665240.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: Hibernate Vs OpenJPA

Posted by mauro2java2011 <ma...@gmail.com>.
escuse me but i not understand : 
-------------------------------------------------------------------
nothing or weaving too (to support blobs for instance or some lazy loading
on 1-1 IIRC)  ??????????
-----------------------------------------------------------
A) escuse me but i not have understand what it is 1-1 IIRC  ......

B)Without weaving hibernate not support blobs for example or lazy loading ?
Romain Manni-Bucau wrote
> Hi
> 
> i answered inline
> 
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau &lt;https://twitter.com/rmannibucau&gt;*
> *Blog:
> **http://rmannibucau.wordpress.com/*&lt;http://rmannibucau.wordpress.com/&gt;
> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> *Github: https://github.com/rmannibucau*
> 
> 
> 
> 2013/9/24 mauro2java2011 &lt;

> mauro2java2011@

> &gt;
> 
>> I know that OpenJPA weaving entity statically or dinamitically with a
>> java
>> agent true ??????
>>
>>
>> I make 3 ask :
>>
>> 1) HIbernate not weave the entities???
>> OR what mechanosme it use ????
>>
> 
> nothing or weaving too (to support blobs for instance or some lazy loading
> on 1-1 IIRC)
> 
> 
>>
>> 2) If i use a project client that make call remote at a tomee application
>> and i get entities like value return of EJb methods , i have to have into
>> classpath of client the entities weave.
>> SO how i can get statically the entities at build time with netbeans ?
>> for
>> incluede it int othe client project .
>>
> 
> using DTO avoids it otherwise yes cause of serialization mecanisms, on
> trunk you can use another serializer than java default mecanism so it
> would
> solve it
> 
> 
>>
>> 3) With hibernate is not  mandatory  weaving entity ? SO i can compile
>> without weaving entity for place into the classpath of client ?
>>
>>
>>
> same with openjpa using the javaagent (openejb-javaagent)
> 
> 
>>
>>
>>
>> --
>> View this message in context:
>> http://openejb.979440.n4.nabble.com/Hibernate-Vs-OpenJPA-tp4665234.html
>> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>


Romain Manni-Bucau wrote
> Hi
> 
> i answered inline
> 
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau &lt;https://twitter.com/rmannibucau&gt;*
> *Blog:
> **http://rmannibucau.wordpress.com/*&lt;http://rmannibucau.wordpress.com/&gt;
> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> *Github: https://github.com/rmannibucau*
> 
> 
> 
> 2013/9/24 mauro2java2011 &lt;

> mauro2java2011@

> &gt;
> 
>> I know that OpenJPA weaving entity statically or dinamitically with a
>> java
>> agent true ??????
>>
>>
>> I make 3 ask :
>>
>> 1) HIbernate not weave the entities???
>> OR what mechanosme it use ????
>>
> 
> nothing or weaving too (to support blobs for instance or some lazy loading
> on 1-1 IIRC)
> 
> 
>>
>> 2) If i use a project client that make call remote at a tomee application
>> and i get entities like value return of EJb methods , i have to have into
>> classpath of client the entities weave.
>> SO how i can get statically the entities at build time with netbeans ?
>> for
>> incluede it int othe client project .
>>
> 
> using DTO avoids it otherwise yes cause of serialization mecanisms, on
> trunk you can use another serializer than java default mecanism so it
> would
> solve it
> 
> 
>>
>> 3) With hibernate is not  mandatory  weaving entity ? SO i can compile
>> without weaving entity for place into the classpath of client ?
>>
>>
>>
> same with openjpa using the javaagent (openejb-javaagent)
> 
> 
>>
>>
>>
>> --
>> View this message in context:
>> http://openejb.979440.n4.nabble.com/Hibernate-Vs-OpenJPA-tp4665234.html
>> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>





--
View this message in context: http://openejb.979440.n4.nabble.com/Hibernate-Vs-OpenJPA-tp4665234p4665240.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Hibernate Vs OpenJPA

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

i answered inline

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/9/24 mauro2java2011 <ma...@gmail.com>

> I know that OpenJPA weaving entity statically or dinamitically with a java
> agent true ??????
>
>
> I make 3 ask :
>
> 1) HIbernate not weave the entities???
> OR what mechanosme it use ????
>

nothing or weaving too (to support blobs for instance or some lazy loading
on 1-1 IIRC)


>
> 2) If i use a project client that make call remote at a tomee application
> and i get entities like value return of EJb methods , i have to have into
> classpath of client the entities weave.
> SO how i can get statically the entities at build time with netbeans ? for
> incluede it int othe client project .
>

using DTO avoids it otherwise yes cause of serialization mecanisms, on
trunk you can use another serializer than java default mecanism so it would
solve it


>
> 3) With hibernate is not  mandatory  weaving entity ? SO i can compile
> without weaving entity for place into the classpath of client ?
>
>
>
same with openjpa using the javaagent (openejb-javaagent)


>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Hibernate-Vs-OpenJPA-tp4665234.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>