You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Thomas Bernhard <tb...@yahoo.com> on 2008/02/20 20:08:31 UTC

How to migrate from Hibernate to Cayenne?

Hi,

Is there a migration guide from Hibernate(especially 2.x.x) to Cayenne
(whatever version)?

Or even better, is there maybe some tool that helps this even further?
(when moving from Velocity to Freemarker there's a tool to automate this,
and even other frameworks have "migration" tools to help uses move from the
concurrence :) )

Thank you,

Tom.
-- 
View this message in context: http://www.nabble.com/How-to-migrate-from-Hibernate-to-Cayenne--tp15596160p15596160.html
Sent from the Cayenne - User mailing list archive at Nabble.com.


Re: How to migrate from Hibernate to Cayenne?

Posted by Thomas Bernhard <tb...@yahoo.com>.

Mike Kienenberger wrote:
> 
> Cayenne does have the same capabilities.  I generate DAOs, interfaces,
> web pages, config files, and, on occasion, entire applications (struts
> & jsf) from the Cayenne modeler using the cgen ant task.   You can
> also do this from the Cayenne Modeler directly now.
> 
> But...
> 
> You will need to provide your own templates to do it.
> Cayenne does not provide such templates, except for POJOs.
> 
Well I read it so: "it could have the same capabitlities, but it doesn't
unless you implement those templates" :).

Besides, it's not just about about a bunch of templates, but the required
GUI to turn the individual features on/off or aditional parameters.
I checked the entire CM but I see that at the moment the GUI of CM supports
only POJOs.

Tom
-- 
View this message in context: http://www.nabble.com/How-to-migrate-from-Hibernate-to-Cayenne--tp15596160p15600743.html
Sent from the Cayenne - User mailing list archive at Nabble.com.


Re: How to migrate from Hibernate to Cayenne?

Posted by Mike Kienenberger <mk...@gmail.com>.
Cayenne does have the same capabilities.  I generate DAOs, interfaces,
web pages, config files, and, on occasion, entire applications (struts
& jsf) from the Cayenne modeler using the cgen ant task.   You can
also do this from the Cayenne Modeler directly now.

But...

You will need to provide your own templates to do it.
Cayenne does not provide such templates, except for POJOs.

And it's in velocity, not freemarker, since you brought up your
migration from one to the other.


On Wed, Feb 20, 2008 at 4:05 PM, Thomas Bernhard <tb...@yahoo.com> wrote:
>
>
>  Scott A wrote:
>  >
>  > Take a look at the Cayenne Modeler; there is a feature to "Reengineer
>  > Database Schema" on the tools menu. You may be unable to do this with
>  > standard user-level permissions, depending on your database type and
>  > configuration. Then you'll be able to generate the POJOs which should
>  > resemble quite closely your hibernate POJOs.
>  >
>  I'm aware of CM and the reengineer feature, but unfortunately it does only a
>  small part of the work.
>
>  When the Hibernate applciation was made, it was mostly "generated" with
>  Hibernate Synchronizer.
>  It has generated not only the POJOs but the DAOs and default queries for the
>  entire model too (and composite PKs too) - all these without tweaking
>  directly from the config files (generated form the DB with middlegen) with
>  just a few clicks.
>
>  CM however doesn't seem to have these "advanced" generation features :(.
>  Is the default "way" in Cayenne to do these manually?
>
>  Thank you,
>
>  Tom.
>  --
>  View this message in context: http://www.nabble.com/How-to-migrate-from-Hibernate-to-Cayenne--tp15596160p15598178.html
>
>
> Sent from the Cayenne - User mailing list archive at Nabble.com.
>
>

Re: How to migrate from Hibernate to Cayenne?

Posted by Thomas Bernhard <tb...@yahoo.com>.

Andrus Adamchik wrote:
> 
> If you have a "regular" generated structure in your data layer, you  
> can hack up a Velocity cgen template to match what you have for the  
> Hibernate project and run it either with the Modeler or better - with  
> cgen Ant task.
> 
There's some structure but it is too "hibernate oriented", and it doesn't
looks like what I see in most example applcations that use Cayenne :).
I think since Cayenne has it's own style, CM could generate according to
this style.


Andrus Adamchik wrote:
> 
> For some sample templates, check out "src/dotemplates/v1_2" folder in  
> the Cayenne distro.
> 
That's nice, but it would be even nicer if some sort of GUI could be defined
together with custom templates as in most cases more imput is required from
the user.

Thank you,

Tom. 
-- 
View this message in context: http://www.nabble.com/How-to-migrate-from-Hibernate-to-Cayenne--tp15596160p15600868.html
Sent from the Cayenne - User mailing list archive at Nabble.com.


Re: How to migrate from Hibernate to Cayenne?

Posted by Andrus Adamchik <an...@objectstyle.org>.
If you have a "regular" generated structure in your data layer, you  
can hack up a Velocity cgen template to match what you have for the  
Hibernate project and run it either with the Modeler or better - with  
cgen Ant task.

For some sample templates, check out "src/dotemplates/v1_2" folder in  
the Cayenne distro.

Andrus


On Feb 20, 2008, at 11:05 PM, Thomas Bernhard wrote:
>
> Scott A wrote:
>>
>> Take a look at the Cayenne Modeler; there is a feature to "Reengineer
>> Database Schema" on the tools menu. You may be unable to do this with
>> standard user-level permissions, depending on your database type and
>> configuration. Then you'll be able to generate the POJOs which should
>> resemble quite closely your hibernate POJOs.
>>
> I'm aware of CM and the reengineer feature, but unfortunately it  
> does only a
> small part of the work.
>
> When the Hibernate applciation was made, it was mostly "generated"  
> with
> Hibernate Synchronizer.
> It has generated not only the POJOs but the DAOs and default queries  
> for the
> entire model too (and composite PKs too) - all these without tweaking
> directly from the config files (generated form the DB with  
> middlegen) with
> just a few clicks.
>
> CM however doesn't seem to have these "advanced" generation  
> features :(.
> Is the default "way" in Cayenne to do these manually?
>
> Thank you,
>
> Tom.
> -- 
> View this message in context: http://www.nabble.com/How-to-migrate-from-Hibernate-to-Cayenne--tp15596160p15598178.html
> Sent from the Cayenne - User mailing list archive at Nabble.com.
>
>


RE: How to migrate from Hibernate to Cayenne?

Posted by Thomas Bernhard <tb...@yahoo.com>.

Scott A wrote:
> 
> Take a look at the Cayenne Modeler; there is a feature to "Reengineer
> Database Schema" on the tools menu. You may be unable to do this with
> standard user-level permissions, depending on your database type and
> configuration. Then you'll be able to generate the POJOs which should
> resemble quite closely your hibernate POJOs.
> 
I'm aware of CM and the reengineer feature, but unfortunately it does only a
small part of the work.

When the Hibernate applciation was made, it was mostly "generated" with
Hibernate Synchronizer.
It has generated not only the POJOs but the DAOs and default queries for the
entire model too (and composite PKs too) - all these without tweaking
directly from the config files (generated form the DB with middlegen) with
just a few clicks.

CM however doesn't seem to have these "advanced" generation features :(.
Is the default "way" in Cayenne to do these manually?

Thank you,

Tom.
-- 
View this message in context: http://www.nabble.com/How-to-migrate-from-Hibernate-to-Cayenne--tp15596160p15598178.html
Sent from the Cayenne - User mailing list archive at Nabble.com.


Re: How to migrate from Hibernate to Cayenne?

Posted by Michael Gentry <bl...@gmail.com>.
I pretty much concur with Malcom's thoughts.  You aren't alone.  :-)

2008/2/21 Malcolm Edgar <ma...@gmail.com>:
> <rant>
>
>  Well personally I think the whole POJO thing has been completely over
>  done. Sure EJB entity beans were not much fun, but saying everything
>  should now extend java.util.Object is stupid.  With persistence API
>  entities need a bunch of support, you can use Cayenne model where you
>  subclass intelligent objects, or you can use "black magic" runtime
>  byte code enhancement.  I prefer the former because I can drill
>  through the code, and use a debugger. However all the fashion now days
>  it to go down the byte code enhancement path.
>
>  This is particularly stupid with Web frameworks, which have recently
>  adopted this fashion.  Now you see POJO's being used as a kind of a
>  page, with a bunch of annotations, maybe some XML configuration files,
>  and then some special byte code enhancement.  No decent windowing UI
>  framework has ever taken this approach Dephi, Swing, Flex.
>
>  The thing that I find really ironic, is that the Hibernate guys who
>  were using reflection previously bet the crap out of JDO camp, because
>  JDO were using invasive post compilation byte code enhancement.  Now
>  Hibernate now are using runtime byte code enhancement, but have still
>  manage to kill JDO, and create a new JPA based on their design.
>
>  </rant>
>
>  regards Malcolm Edgar

Re: How to migrate from Hibernate to Cayenne?

Posted by Malcolm Edgar <ma...@gmail.com>.
<rant>

Well personally I think the whole POJO thing has been completely over
done. Sure EJB entity beans were not much fun, but saying everything
should now extend java.util.Object is stupid.  With persistence API
entities need a bunch of support, you can use Cayenne model where you
subclass intelligent objects, or you can use "black magic" runtime
byte code enhancement.  I prefer the former because I can drill
through the code, and use a debugger. However all the fashion now days
it to go down the byte code enhancement path.

This is particularly stupid with Web frameworks, which have recently
adopted this fashion.  Now you see POJO's being used as a kind of a
page, with a bunch of annotations, maybe some XML configuration files,
and then some special byte code enhancement.  No decent windowing UI
framework has ever taken this approach Dephi, Swing, Flex.

The thing that I find really ironic, is that the Hibernate guys who
were using reflection previously bet the crap out of JDO camp, because
JDO were using invasive post compilation byte code enhancement.  Now
Hibernate now are using runtime byte code enhancement, but have still
manage to kill JDO, and create a new JPA based on their design.

</rant>

regards Malcolm Edgar

On Fri, Feb 22, 2008 at 1:49 AM, Borut Bolčina <bo...@gmail.com> wrote:
> Hello,
>
>  since when can modeler generate POJOs? AFAIK those generated classes extend
>  CayenneDataObject which in turn implements three interfaces, therefore
>  making it a complex object model.
>
>  Did I miss something lately?
>
>  -Borut
>
>  2008/2/20, Scott Anderson <sa...@airvana.com>:
>
>
> >
>  > Tom,
>  >
>  > Take a look at the Cayenne Modeler; there is a feature to "Reengineer
>  > Database Schema" on the tools menu. You may be unable to do this with
>  > standard user-level permissions, depending on your database type and
>  > configuration. Then you'll be able to generate the POJOs which should
>  > resemble quite closely your hibernate POJOs.
>  >
>  > Regards,
>  >
>  > Scott
>  >
>  >
>  > -----Original Message-----
>  > From: Thomas Bernhard [mailto:tbernhard@yahoo.com]
>  > Sent: Wednesday, February 20, 2008 2:09 PM
>  > To: user@cayenne.apache.org
>  > Subject: How to migrate from Hibernate to Cayenne?
>  >
>  >
>  > Hi,
>  >
>  > Is there a migration guide from Hibernate(especially 2.x.x) to Cayenne
>  > (whatever version)?
>  >
>  > Or even better, is there maybe some tool that helps this even further?
>  > (when moving from Velocity to Freemarker there's a tool to automate
>  > this, and even other frameworks have "migration" tools to help uses move
>  > from the concurrence :) )
>  >
>  > Thank you,
>  >
>  > Tom.
>  > --
>  > View this message in context:
>  > http://www.nabble.com/How-to-migrate-from-Hibernate-to-Cayenne--tp155961
>  > 60p15596160.html
>  > Sent from the Cayenne - User mailing list archive at Nabble.com.
>  >
>  >
>

Re: How to migrate from Hibernate to Cayenne?

Posted by Borut Bolčina <bo...@gmail.com>.
Hello,

since when can modeler generate POJOs? AFAIK those generated classes extend
CayenneDataObject which in turn implements three interfaces, therefore
making it a complex object model.

Did I miss something lately?

-Borut

2008/2/20, Scott Anderson <sa...@airvana.com>:
>
> Tom,
>
> Take a look at the Cayenne Modeler; there is a feature to "Reengineer
> Database Schema" on the tools menu. You may be unable to do this with
> standard user-level permissions, depending on your database type and
> configuration. Then you'll be able to generate the POJOs which should
> resemble quite closely your hibernate POJOs.
>
> Regards,
>
> Scott
>
>
> -----Original Message-----
> From: Thomas Bernhard [mailto:tbernhard@yahoo.com]
> Sent: Wednesday, February 20, 2008 2:09 PM
> To: user@cayenne.apache.org
> Subject: How to migrate from Hibernate to Cayenne?
>
>
> Hi,
>
> Is there a migration guide from Hibernate(especially 2.x.x) to Cayenne
> (whatever version)?
>
> Or even better, is there maybe some tool that helps this even further?
> (when moving from Velocity to Freemarker there's a tool to automate
> this, and even other frameworks have "migration" tools to help uses move
> from the concurrence :) )
>
> Thank you,
>
> Tom.
> --
> View this message in context:
> http://www.nabble.com/How-to-migrate-from-Hibernate-to-Cayenne--tp155961
> 60p15596160.html
> Sent from the Cayenne - User mailing list archive at Nabble.com.
>
>

RE: How to migrate from Hibernate to Cayenne?

Posted by Scott Anderson <sa...@airvana.com>.
Tom,

Take a look at the Cayenne Modeler; there is a feature to "Reengineer
Database Schema" on the tools menu. You may be unable to do this with
standard user-level permissions, depending on your database type and
configuration. Then you'll be able to generate the POJOs which should
resemble quite closely your hibernate POJOs.

Regards,
Scott

-----Original Message-----
From: Thomas Bernhard [mailto:tbernhard@yahoo.com] 
Sent: Wednesday, February 20, 2008 2:09 PM
To: user@cayenne.apache.org
Subject: How to migrate from Hibernate to Cayenne?


Hi,

Is there a migration guide from Hibernate(especially 2.x.x) to Cayenne
(whatever version)?

Or even better, is there maybe some tool that helps this even further?
(when moving from Velocity to Freemarker there's a tool to automate
this, and even other frameworks have "migration" tools to help uses move
from the concurrence :) )

Thank you,

Tom.
--
View this message in context:
http://www.nabble.com/How-to-migrate-from-Hibernate-to-Cayenne--tp155961
60p15596160.html
Sent from the Cayenne - User mailing list archive at Nabble.com.


Re: How to migrate from Hibernate to Cayenne?

Posted by Andrus Adamchik <an...@objectstyle.org>.
AFAIK no such thing exists as of now. Not sure about others, but  
luckily I was spared from any such migrations. Would be nice if  
somebody with a real experience could document what they needed to do.

My guess on the high level approach would be to start with reverse  
engineering the DB schema, and generating Cayenne superclasses with  
Hibernate current classes mapped as subclasses. And then fix the API  
calls manually. But I am sure there are quirks for non-flat mapping  
scenarios (inheritance and such). Also you may need to rethink some  
app concepts... E.g. Cayenne doesn't force transactions on you unless  
you *must* have them... things like that.

Andrus

P.S. When I was about to hit "send", I noticed a message from Scott  
Anderson, based on the same idea.


On Feb 20, 2008, at 9:08 PM, Thomas Bernhard wrote:

>
> Hi,
>
> Is there a migration guide from Hibernate(especially 2.x.x) to Cayenne
> (whatever version)?
>
> Or even better, is there maybe some tool that helps this even further?
> (when moving from Velocity to Freemarker there's a tool to automate  
> this,
> and even other frameworks have "migration" tools to help uses move  
> from the
> concurrence :) )
>
> Thank you,
>
> Tom.
> -- 
> View this message in context: http://www.nabble.com/How-to-migrate-from-Hibernate-to-Cayenne--tp15596160p15596160.html
> Sent from the Cayenne - User mailing list archive at Nabble.com.