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

Eta Huang huangkai at primeton.com
Thu Oct 12 03:38:18 EDT 2006


In fact, SDO can have an open structure like XML, or sealed like POJO, depending on one of the type's meta infomation(called 'isOpen'). For short, SDO object's structure can be dynamic or static, and SDO objects' instances can also be accessed in dynamic or static way, and SDO has it's own way for reflection.....
but, well, I don't want to dive into the details of SDO concept here :p. 
 I just wanna to know if there is an easy way to customize Object's reflection , get/set, proxy mechanism  of hibernate for another structure support other than POJO/DOM4j/Dynamic-Map 
If You can image , or refer to official specification(dev2dev.bea.com/pub/a/2005/11/sdo.html) for a complete illustration.

----- Original Message ----- 
From: "Max Rydahl Andersen" <max.andersen at jboss.com>
To: "Eta Huang" <huangkai at primeton.com>
Cc: <hibernate-dev at lists.jboss.org>
Sent: Thursday, October 12, 2006 3:21 PM
Subject: Re: [hibernate-dev] What is the easiest and safest way to customize Hiberate for other entity mode?



> 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