[hibernate-dev] What is the easiest and safest way to customize Hiberate for other entity mode?

Max Rydahl Andersen max.andersen at jboss.com
Thu Oct 12 03:21:16 EDT 2006


> Actually, SDO object is a common but special DTO object.

A DTO object normally has some structure; otherwise how do users know what  
to get from it ? :)

> It has some dynamic feature similiar to XML, what's more, it has no  
> static setter/getter method, so hibernate won't recognize it as a  
> JavaBean object
> dynamic-map mode in hibernate is good, but not enough, I'm not sure  
> whether it can support inheritance and relationship as good as POJO.

the lack of setter/getters is not a problem since we have both Tuplizer  
and PropertyAccessors to deal with this.

And the dynamic part is probably not something you want to reflect down to  
the persistence layer/db since then
you would end up having a schema layout of two tables Entities and  
Attributes which is rarely usefull.

I'm not up to speed with how a SDO actually looks like. Is it something  
like:

class Employee extends SDOObject {

    public String getName() {
       return getAttribute("name").asString();
    }

    public int getAge() {
       return getAttribute("age").asInt();
    }

    public Set getFriends() ..
}

or

SDOObject employee = new SDOObject("Employee);
employee.setAttribute("name", "Ed");
employee.setAttribute("age", 12);
employee.setCollection("friends", <set of other SDO's>)
?

The first one should be trivial to do

The second one is harder since it requires you to be explicit about what  
"type" the actual instance is.

/max

> ----- Original Message -----
> From: "Max Rydahl Andersen" <max.andersen at jboss.com>
> To: "Eta Huang" <huangkai at primeton.com>
> Sent: Wednesday, October 11, 2006 4:48 PM
> Subject: Re: [hibernate-dev] What is the easiest and safest way to  
> customize Hiberate for other entity mode?
>
>
>> On Wed, 11 Oct 2006 04:10:56 +0200, Eta Huang <huangkai at primeton.com>
>> wrote:
>>
>>> Hi all:
>>>    I'm developing SDO(Service Data Object) implementation, and when I
>>> wanna persist them Hibernate is the first one came to my mind. I tried
>>> it's dynamic-map mode, but that's not what i expected, I want to
>>> customize Hibernate to make it full SDO support. For the sake of  
>>> safety,
>>> the minimal classes needed to be overrided or changed, the better.
>>>    Any hibernate guru can show me the right way? very thankful!
>>
>> What are the problems you are forseeing with SDO's ?
>>
>> Could you sum up the differences there are between a JavaBean and SDO ?
>>
>> Is SDO's completely dynamic and has no fixed structure ?
>>
>> --
>> --
>> Max Rydahl Andersen
>> callto://max.rydahl.andersen
>>
>> Hibernate
>> max at hibernate.org
>> http://hibernate.org
>>
>> JBoss a division of Red Hat
>> max.andersen at jboss.com
>>



-- 
--
Max Rydahl Andersen
callto://max.rydahl.andersen

Hibernate
max at hibernate.org
http://hibernate.org

JBoss a division of Red Hat
max.andersen at jboss.com




More information about the hibernate-dev mailing list