You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by "Hans J. Prueller" <ha...@gmx.net> on 2007/02/01 16:41:52 UTC

using OpenJPA in EJB2.1 application (was: ejb2.1 to Geronimo2.0 migration strategy)

Hi together,

 

I decided that it would be a valuable way to migrate existing CMP2.1 EJBs to
OpenJPA, as this should also work

OUTSIDE a Java EE 5 (and therefore inside EJB2.1) container. The problem I
see is that I have to provide the OpenJPA

mappings as Java5 annotations, and EJB2.1 projects are bound to Java 1.4 -
without having annotations. 

 

Is there a way of providing the mapping via XML-descriptor too?

Does anybody see other possible failures when running OpenJPA within a Java
EE 1.4 container?

 

regards,
Hans

 

 

=========================== 
virtually hanzz...

 

 <http://hanzz.zapto.org> http://hanzz.zapto.org (personal)
 <http://www.cse.dmu.ac.uk/~hansp> http://www.cse.dmu.ac.uk/~hansp
(research)

 


Re: AW: AW: using OpenJPA in EJB2.1 application (was: ejb2.1 to Geronimo2.0 migration strategy)

Posted by David Jencks <da...@yahoo.com>.
On Feb 1, 2007, at 12:21 PM, Hans J. Prueller wrote:

> >> However I suspect if you can convince the other app server to  
> run under jdk 1.5 openjpa will be
>
> >> able to deal with annotations just as it does in geronimo.
>
>
>
> fine.
>
>
>
> >> I think the major problem you are likely to run into is that  
> unless there's container managed persitence
>
> >> contexts your transaction behavior is going to be difficult to  
> control.
>
>
>
> I hoped that I could configure openJPA to use the transaction  
> manager provided by the container – for example we
>
> successfully integrated Hibernate Persistence and CMP Persistence  
> within our application, both running within
>
> the same transactions. there has been something like a plugin  
> developed:
>
>
>
> <property name="hibernate.transaction.manager_lookup_class">
>
> org.hibernate.transaction.JOTMTransactionManagerLookup
>
> </property>
>
>
>
> Is there any means of “plugging” transaction manager into openJPA  
> persistence?

There's a bunch of code in openjpa that will look all over the jndi  
tree for a transaction manager.  I'm not sure if you have to turn it  
on using an option.  I'm also not sure if that's sufficient to get  
your persistence contexts enrolled in a jta tx.  My guess is that it  
will but I haven't read the spec or played with this for a while so I  
might be wrong.

thanks
david jencks

>
>
> HANS
>
>
>
> Von: David Jencks [mailto:david_jencks@yahoo.com]
> Gesendet: Donnerstag, 01. Februar 2007 20:49
> An: user@geronimo.apache.org
> Betreff: Re: AW: using OpenJPA in EJB2.1 application (was: ejb2.1  
> to Geronimo2.0 migration strategy)
>
>
>
>
>
> On Feb 1, 2007, at 10:48 AM, Hans J. Prueller wrote:
>
>
>
>
> david,
>
>
>
> thank you for your comments.
>
>
>
> please note: our problem is that we have to migrate a project  
> consisting of about 70 CMP/CMR’ed entity beans (ejb2.1).
>
> it will be impossible for us to migrate the whole app at once from  
> ejb2.1 to openJPA or something else. so what my plan
>
> is, is to continue running the application within our current  
> ejb2.1 container and perform a step-by-step migration of the
>
> ejb2.1 entity beans from ejb2.1 to openJPA – still running within  
> our ejb2.1 container.
>
>
>
> as soon as all “old” entity beans are migrated to openJPA we then  
> could easily switch the whole app to Geronimo.
>
>
>
> Sorry, I forgot you are trying to run your app in a _different_  
> ejb2.1 container :-)
>
>
>
> You should still be able to specify the mapping in a mapping.xml.   
> However I suspect if you can convince the other app server to run  
> under jdk 1.5 openjpa will be able to deal with annotations just as  
> it does in geronimo.
>
>
>
> I think the major problem you are likely to run into is that unless  
> there's container managed persitence contexts your transaction  
> behavior is going to be difficult to control.
>
>
>
> thanks
>
> david jencks
>
>
>
>
>
>
> Hans
>
>
>
> Von: David Jencks [mailto:david_jencks@yahoo.com]
> Gesendet: Donnerstag, 01. Februar 2007 18:29
> An: user@geronimo.apache.org
> Betreff: Re: using OpenJPA in EJB2.1 application (was: ejb2.1 to  
> Geronimo2.0 migration strategy)
>
>
>
>
>
> On Feb 1, 2007, at 7:41 AM, Hans J. Prueller wrote:
>
>
>
>
>
> Hi together,
>
>
>
> I decided that it would be a valuable way to migrate existing  
> CMP2.1 EJBs to OpenJPA, as this should also work
>
> OUTSIDE a Java EE 5 (and therefore inside EJB2.1) container. The  
> problem I see is that I have to provide the OpenJPA
>
> mappings as Java5 annotations, and EJB2.1 projects are bound to  
> Java 1.4 – without having annotations.
>
> run geronimo under jdk 1.5.  This will work unless you are using  
> corba.  The almost released 1.2 might work if you are using corba.
>
>
>
>
>
> Is there a way of providing the mapping via XML-descriptor too?
>
>
>
> yes, as per jpa spec.
>
>
>
> Does anybody see other possible failures when running OpenJPA  
> within a Java EE 1.4 container?
>
>
>
> I'm not sure why you don't want to use annotations. You should use  
> the geronimo 1.2 not-quite-released version which includes jpa and  
> in particular openjpa support.  I converted the daytrader  
> performance test app to use jpa and it works fine.  In particular  
> you can use container managed entity managers/persistence contexts  
> rather than app managed ones.  You might like to take a look at  
> daytrader trunk, it has all the annotations and a jpa plan.  You do  
> need to run geronimo under jdk 1.5 for this to work.
>
>
>
> svn co https://svn.apache.org/repos/asf/geronimo/daytrader/trunk  
> daytrader
>
>
>
> thanks
>
> david jencks
>
>
>
>
>
>
>
>
>
>
>
> regards,
> Hans
>
>
>
>
>
> ===========================
> virtually hanzz...
>
>
>
> http://hanzz.zapto.org (personal)
> http://www.cse.dmu.ac.uk/~hansp (research)
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


AW: AW: using OpenJPA in EJB2.1 application (was: ejb2.1 to Geronimo2.0 migration strategy)

Posted by "Hans J. Prueller" <ha...@gmx.net>.
>> However I suspect if you can convince the other app server to run under
jdk 1.5 openjpa will be 

>> able to deal with annotations just as it does in geronimo.

 

fine. 

 

>> I think the major problem you are likely to run into is that unless
there's container managed persitence 

>> contexts your transaction behavior is going to be difficult to control.

 

I hoped that I could configure openJPA to use the transaction manager
provided by the container - for example we

successfully integrated Hibernate Persistence and CMP Persistence within our
application, both running within

the same transactions. there has been something like a plugin developed:

 

<property name="hibernate.transaction.manager_lookup_class">

org.hibernate.transaction.JOTMTransactionManagerLookup

</property>

 

Is there any means of "plugging" transaction manager into openJPA
persistence?

 

HANS

 

  _____  

Von: David Jencks [mailto:david_jencks@yahoo.com] 
Gesendet: Donnerstag, 01. Februar 2007 20:49
An: user@geronimo.apache.org
Betreff: Re: AW: using OpenJPA in EJB2.1 application (was: ejb2.1 to
Geronimo2.0 migration strategy)

 

 

On Feb 1, 2007, at 10:48 AM, Hans J. Prueller wrote:





david,

 

thank you for your comments.

 

please note: our problem is that we have to migrate a project consisting of
about 70 CMP/CMR'ed entity beans (ejb2.1).

it will be impossible for us to migrate the whole app at once from ejb2.1 to
openJPA or something else. so what my plan

is, is to continue running the application within our current ejb2.1
container and perform a step-by-step migration of the

ejb2.1 entity beans from ejb2.1 to openJPA - still running within our ejb2.1
container.

 

as soon as all "old" entity beans are migrated to openJPA we then could
easily switch the whole app to Geronimo.

 

Sorry, I forgot you are trying to run your app in a _different_ ejb2.1
container :-)

 

You should still be able to specify the mapping in a mapping.xml.  However I
suspect if you can convince the other app server to run under jdk 1.5
openjpa will be able to deal with annotations just as it does in geronimo.

 

I think the major problem you are likely to run into is that unless there's
container managed persitence contexts your transaction behavior is going to
be difficult to control.

 

thanks

david jencks





 

Hans

 

  _____  

Von: David Jencks [mailto:david_jencks@yahoo.com] 
Gesendet: Donnerstag, 01. Februar 2007 18:29
An: user@geronimo.apache.org
Betreff: Re: using OpenJPA in EJB2.1 application (was: ejb2.1 to Geronimo2.0
migration strategy)

 

 

On Feb 1, 2007, at 7:41 AM, Hans J. Prueller wrote:






Hi together,

 

I decided that it would be a valuable way to migrate existing CMP2.1 EJBs to
OpenJPA, as this should also work

OUTSIDE a Java EE 5 (and therefore inside EJB2.1) container. The problem I
see is that I have to provide the OpenJPA

mappings as Java5 annotations, and EJB2.1 projects are bound to Java 1.4 -
without having annotations.

run geronimo under jdk 1.5.  This will work unless you are using corba.  The
almost released 1.2 might work if you are using corba.




 

Is there a way of providing the mapping via XML-descriptor too?

 

yes, as per jpa spec.




Does anybody see other possible failures when running OpenJPA within a Java
EE 1.4 container?

 

I'm not sure why you don't want to use annotations. You should use the
geronimo 1.2 not-quite-released version which includes jpa and in particular
openjpa support.  I converted the daytrader performance test app to use jpa
and it works fine.  In particular you can use container managed entity
managers/persistence contexts rather than app managed ones.  You might like
to take a look at daytrader trunk, it has all the annotations and a jpa
plan.  You do need to run geronimo under jdk 1.5 for this to work.

 

svn co  <https://svn.apache.org/repos/asf/geronimo/daytrader/trunk>
https://svn.apache.org/repos/asf/geronimo/daytrader/trunk daytrader

 

thanks

david jencks

 

 






 

regards,
Hans

 

 

=========================== 
virtually hanzz...

 

 <http://hanzz.zapto.org> http://hanzz.zapto.org (personal)
 <http://www.cse.dmu.ac.uk/~hansp> http://www.cse.dmu.ac.uk/~hansp
(research)

 






 





 


Re: AW: using OpenJPA in EJB2.1 application (was: ejb2.1 to Geronimo2.0 migration strategy)

Posted by David Jencks <da...@yahoo.com>.
On Feb 1, 2007, at 10:48 AM, Hans J. Prueller wrote:

> david,
>
>
>
> thank you for your comments.
>
>
>
> please note: our problem is that we have to migrate a project  
> consisting of about 70 CMP/CMR’ed entity beans (ejb2.1).
>
> it will be impossible for us to migrate the whole app at once from  
> ejb2.1 to openJPA or something else. so what my plan
>
> is, is to continue running the application within our current  
> ejb2.1 container and perform a step-by-step migration of the
>
> ejb2.1 entity beans from ejb2.1 to openJPA – still running within  
> our ejb2.1 container.
>
>
>
> as soon as all “old” entity beans are migrated to openJPA we then  
> could easily switch the whole app to Geronimo.

Sorry, I forgot you are trying to run your app in a _different_  
ejb2.1 container :-)

You should still be able to specify the mapping in a mapping.xml.   
However I suspect if you can convince the other app server to run  
under jdk 1.5 openjpa will be able to deal with annotations just as  
it does in geronimo.

I think the major problem you are likely to run into is that unless  
there's container managed persitence contexts your transaction  
behavior is going to be difficult to control.

thanks
david jencks

>
>
> Hans
>
>
>
> Von: David Jencks [mailto:david_jencks@yahoo.com]
> Gesendet: Donnerstag, 01. Februar 2007 18:29
> An: user@geronimo.apache.org
> Betreff: Re: using OpenJPA in EJB2.1 application (was: ejb2.1 to  
> Geronimo2.0 migration strategy)
>
>
>
>
>
> On Feb 1, 2007, at 7:41 AM, Hans J. Prueller wrote:
>
>
>
>
> Hi together,
>
>
>
> I decided that it would be a valuable way to migrate existing  
> CMP2.1 EJBs to OpenJPA, as this should also work
>
> OUTSIDE a Java EE 5 (and therefore inside EJB2.1) container. The  
> problem I see is that I have to provide the OpenJPA
>
> mappings as Java5 annotations, and EJB2.1 projects are bound to  
> Java 1.4 – without having annotations.
>
> run geronimo under jdk 1.5.  This will work unless you are using  
> corba.  The almost released 1.2 might work if you are using corba.
>
>
>
>
> Is there a way of providing the mapping via XML-descriptor too?
>
>
>
> yes, as per jpa spec.
>
>
> Does anybody see other possible failures when running OpenJPA  
> within a Java EE 1.4 container?
>
>
>
> I'm not sure why you don't want to use annotations. You should use  
> the geronimo 1.2 not-quite-released version which includes jpa and  
> in particular openjpa support.  I converted the daytrader  
> performance test app to use jpa and it works fine.  In particular  
> you can use container managed entity managers/persistence contexts  
> rather than app managed ones.  You might like to take a look at  
> daytrader trunk, it has all the annotations and a jpa plan.  You do  
> need to run geronimo under jdk 1.5 for this to work.
>
>
>
> svn co https://svn.apache.org/repos/asf/geronimo/daytrader/trunk  
> daytrader
>
>
>
> thanks
>
> david jencks
>
>
>
>
>
>
>
>
>
>
> regards,
> Hans
>
>
>
>
>
> ===========================
> virtually hanzz...
>
>
>
> http://hanzz.zapto.org (personal)
> http://www.cse.dmu.ac.uk/~hansp (research)
>
>
>
>
>
>
>
>
>


AW: using OpenJPA in EJB2.1 application (was: ejb2.1 to Geronimo2.0 migration strategy)

Posted by "Hans J. Prueller" <ha...@gmx.net>.
david,

 

thank you for your comments.

 

please note: our problem is that we have to migrate a project consisting of
about 70 CMP/CMR'ed entity beans (ejb2.1).

it will be impossible for us to migrate the whole app at once from ejb2.1 to
openJPA or something else. so what my plan

is, is to continue running the application within our current ejb2.1
container and perform a step-by-step migration of the

ejb2.1 entity beans from ejb2.1 to openJPA - still running within our ejb2.1
container.

 

as soon as all "old" entity beans are migrated to openJPA we then could
easily switch the whole app to Geronimo.

 

Hans

 

  _____  

Von: David Jencks [mailto:david_jencks@yahoo.com] 
Gesendet: Donnerstag, 01. Februar 2007 18:29
An: user@geronimo.apache.org
Betreff: Re: using OpenJPA in EJB2.1 application (was: ejb2.1 to Geronimo2.0
migration strategy)

 

 

On Feb 1, 2007, at 7:41 AM, Hans J. Prueller wrote:





Hi together,

 

I decided that it would be a valuable way to migrate existing CMP2.1 EJBs to
OpenJPA, as this should also work

OUTSIDE a Java EE 5 (and therefore inside EJB2.1) container. The problem I
see is that I have to provide the OpenJPA

mappings as Java5 annotations, and EJB2.1 projects are bound to Java 1.4 -
without having annotations.

run geronimo under jdk 1.5.  This will work unless you are using corba.  The
almost released 1.2 might work if you are using corba.



 

Is there a way of providing the mapping via XML-descriptor too?

 

yes, as per jpa spec.



Does anybody see other possible failures when running OpenJPA within a Java
EE 1.4 container?

 

I'm not sure why you don't want to use annotations. You should use the
geronimo 1.2 not-quite-released version which includes jpa and in particular
openjpa support.  I converted the daytrader performance test app to use jpa
and it works fine.  In particular you can use container managed entity
managers/persistence contexts rather than app managed ones.  You might like
to take a look at daytrader trunk, it has all the annotations and a jpa
plan.  You do need to run geronimo under jdk 1.5 for this to work.

 

svn co https://svn.apache.org/repos/asf/geronimo/daytrader/trunk daytrader

 

thanks

david jencks

 

 





 

regards,
Hans

 

 

=========================== 
virtually hanzz...

 

 <http://hanzz.zapto.org> http://hanzz.zapto.org (personal)
 <http://www.cse.dmu.ac.uk/~hansp> http://www.cse.dmu.ac.uk/~hansp
(research)

 





 


Re: using OpenJPA in EJB2.1 application (was: ejb2.1 to Geronimo2.0 migration strategy)

Posted by David Jencks <da...@yahoo.com>.
On Feb 1, 2007, at 7:41 AM, Hans J. Prueller wrote:

> Hi together,
>
>
>
> I decided that it would be a valuable way to migrate existing  
> CMP2.1 EJBs to OpenJPA, as this should also work
>
> OUTSIDE a Java EE 5 (and therefore inside EJB2.1) container. The  
> problem I see is that I have to provide the OpenJPA
>
> mappings as Java5 annotations, and EJB2.1 projects are bound to  
> Java 1.4 – without having annotations.
run geronimo under jdk 1.5.  This will work unless you are using  
corba.  The almost released 1.2 might work if you are using corba.
>
>
> Is there a way of providing the mapping via XML-descriptor too?

yes, as per jpa spec.
> Does anybody see other possible failures when running OpenJPA  
> within a Java EE 1.4 container?

I'm not sure why you don't want to use annotations. You should use  
the geronimo 1.2 not-quite-released version which includes jpa and in  
particular openjpa support.  I converted the daytrader performance  
test app to use jpa and it works fine.  In particular you can use  
container managed entity managers/persistence contexts rather than  
app managed ones.  You might like to take a look at daytrader trunk,  
it has all the annotations and a jpa plan.  You do need to run  
geronimo under jdk 1.5 for this to work.

svn co https://svn.apache.org/repos/asf/geronimo/daytrader/trunk  
daytrader

thanks
david jencks



>
>
> regards,
> Hans
>
>
>
>
>
> ===========================
> virtually hanzz...
>
>
>
> http://hanzz.zapto.org (personal)
> http://www.cse.dmu.ac.uk/~hansp (research)
>
>
>
>