commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Aust <christ...@wilde-welt.de>
Subject Re: [betwixt] How can I make betwixt accept any attribute "id" as an element id?
Date Fri, 07 Jan 2005 19:24:08 GMT
Hi Jason,

Am 07.01.2005 um 18:10 schrieb Jason Wood:

> do you want to make the id your from your bean an attribute or id the
> betwixt generated?

instead of making up some id value, betwixt should simply stick with 
the id value that the object already provides. In other words: If a 
bean property "id" exists, it should be converted into an XML attribute 
"id" that will be referenced using "idref" if necessary.

======================================================================
public class Member {
    public long getId()
    public String getName()
    public Member getParent()
}
======================================================================
member 1:
    getId() = 1
    getName() = "John"
    getParent() = null
member 2:
    getId() = 10
    getName() = "Joe
    getParent() = <member1>
======================================================================
<member id="1">
    <name>John</name>
</member>
<member id="2">
    <name>Joe</name>
    <parent idref="1" />
</member>

Any idea how I could do this? Best regards,

-  Christian

> -----Original Message-----
> From: Christian Aust [mailto:christian@wilde-welt.de]
> Sent: Friday, January 07, 2005 11:00 AM
> To: commons-user@jakarta.apache.org
> Subject: [betwixt] How can I make betwixt accept any attribute "id" as
> an element id?
>
>
> Hi,
>
> I'd like to use betwixt to serialize data beans to xml. Those beans
> represent database structures mapped with hibernate, so all of the
> first-rank entities sport some property id, just like this:
>
> public long getId()
>
> Those classes implement equals() as such it considers two elements 
> equal
> if their id matches. Unfortunately, while serializing large object 
> trees
> betwixt doesn't see this and assinges new id values to those instances.
>
> <object id="100">
> 	<id>17</id>
> </object>
>
> What do I have to do in order to make betwixt recognize those id
> attributes as element ids? Thanks a lot and best regards,
>
> -  Christian Aust
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
--

Christian Aust
mailto:christian@wilde-welt.de
icq: 84500990 - Yahoo!: datenimperator - MSN: datenimperator
PGP: A94E 0181 664D 27E3 F05A  A751 6A7E 90D1 A0A3 DEC7


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message