cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilberto C Andrade <gilbert...@gmail.com>
Subject Re: Cayenne POJO enhancer
Date Thu, 25 Oct 2007 15:39:46 GMT
Andrus Adamchik wrote:
> Hi Gilberto,
>
> There's no automated way port a Hibernate project to Cayenne, but you
But, I can map those pojos to jpa config file by hand, can't I?
> can certainly do that manually. I would suggest to use Cayenne

Sorry, I should have mentioned that we will use those new
technology(POJO/JPA/JSF) - Stay with the standard, says my boss.

> traditional non-POJO API (while POJO/JPA stuff is still pre-alpha,
> Cayenne API is production quality and has fewer surprises).
Don't worry, these projects are a little big and we will have some good
time to put them on production. And my boss has decided to go with
POJO/JPA/JSF (So, I can't always win :)).

So, this is a good chance to help cayenne. Or are you suggesting another
one (OpenJPA, Hibernate, TopLink, etc).

Anyway, thanks for you attention!

Gilberto
>
> The quickest way to do that is probably the following:
>
> * reverse engineer the DB in question with CayenneModeler
> * manually tweak the model to match the property names in the existing
> POJO Java classes
> * Run class generator to generate the _Xyz superclasses.
> * Change the existing classes by hand to inherit from _Xyz counterpart.
> * Remove existing persistence fields, and use superclass getters and
> setters to access them.
> * Change the API throughout the code to use Cayenne ObjectContext and
> Queries.
>
> Andrus
>
>
> On Oct 24, 2007, at 10:17 PM, Gilberto C Andrade wrote:
>
>> [This is second email I send, I think the first one get lost]
>> Hi all,
>>
>> I've been searching on docs/maillist about how to persist an already
>> existent pojo, but have no luck. Let me explain: we have two old
>> projects build with hibernate 2.1.8 and all model are marked with
>> hibernate tag on doc area in java source [1].
>> But now we want to use those models with cayenne (3.0M1) without edit
>> them. Is that possible?
>>
>>
>> These systems included the business and data access in the same place.
>> So turning it impossible to change the domain logic. By the way, someone
>> can suggest a good design separation of package?
>> We are now trying this:
>> br.to.gov.secad.<module>.model;
>> br.to.gov.secad.<module>.dao;
>> br.to.gov.secad.<module>.service;
>>
>>
>> Thanks!
>>
>> Gilberto
>>
>> PS.: I think we won the battle about ORM choice. Now comes the new one:
>> beat the eclipse hibernate tools! Thanks all for help!
>>
>> [1]
>> [code]
>> /**
>>  *  Área de atuação do curso: informática, RH, financeira, etc.
>>  *  @hibernate.class table="scc.scc_area"
>> */
>> public class Area implements Serializable {
>>
>>     /** identifier field */
>>     private Integer cdArea;
>>
>>     /** persistent field */
>>     private String dcArea;
>>
>>     /** full constructor */
>>     public Area(Integer cdArea, String dcArea) {
>>         this.cdArea = cdArea;
>>         this.dcArea = dcArea;
>>     }
>>
>>     /** default constructor */
>>     public Area() {
>>     }
>>
>>     /**
>>      * @hibernate.id generator-class="sequence" column="cdarea"
>> unsaved-value = "null"
>>      * @hibernate.generator-param name = "sequence" value =
>> "scc.scc_area_sequence"
>>      * @return Integer
>>      */
>>     public Integer getCdArea() {
>>         return this.cdArea;
>>     }
>>
>>     public void setCdArea(Integer cdarea) {
>>         this.cdArea = cdarea;
>>     }
>>
>>     /**
>>      *   @hibernate.property column="dcarea" length="40" not-null="true"
>>      *
>>      */
>>     public String getDcArea() {
>>         return this.dcArea;
>>     }
>> [/code]
>>
>
>



Mime
View raw message