users@jaxb.java.net

Re: IDREF, ID and xjc:idSymbolSpace

From: Kees <bluemoon_at_xs4all.nl>
Date: Fri, 14 Jan 2005 10:53:06 +0100

>
>
>>>>>> In 2.0, XJC will be able to just generate value classes, so there
>>>>>> won't be any casting between your class and interfaces. Also, in
>>>>>> 2.0, you can have XJC generate the code once, move that into the
>>>>>> repository, and then you can start making modifications to the
>>>>>> generated classes directly.
>>>
>>>
>>>>
>>>>
>>>> Does this mean that if the schema changes (than the code will change)
>>>> and then I have lost all my modifications?
>>
>>
>>
>>
>> There are ways to work around the problem. It is bit like maintaining
>> local changes to a 3rd party source code. For example, CVS can help
>> you manage those.
>
>

hmm, I don't think I can see any use in these new features. I will have
to go through the
jaxb2.0 documentation to know for sure. I hope all annotations (vendor
specific extensions) in
 jaxb1.0 are also supported in jaxb2.0?


>>
>
>
>>>> I'm using the following very simple code-preserving-technic when
>>>> working with ORM (Object/Relational Mapping) tools:
>>>> I let the ORM create an Class gti.conf.EquipmentEntity, but when it
>>>> creates
>>>> the class-file I prepend "generated" before the className. So now
>>>> generated/gti/conf/EquipmentEntity.java is generated. I now have to
>>>> create
>>>> a the class-file gti/conf/EquipmentEntity.java myself (with empty
>>>> constructor).
>>>> In this class-file I can append my modifications without ever getting
>>>> it lost.
>>>> Is this possible in jaxb 1.0?
>>>> or jaxb 2.0?
>>
>>
>>
>>
>> Would you elaborate this step more? In normal Java semantics, you can
>> have two or more source folder but you cannot define one class in two
>> source files.
>>
>> Are you talking about a tool support to "merge" those source files? Or
>> are you talking about two different Java classes associated via a
>> naming convention?
>>
>
>
I'm talking about 2 different java classes via a naming convention :
1. jaxb generates : generated.gti.conf.EquipmentClass
      But it should use internally the class gti.conf.EquipmentClass (see 2)
2. I create : gti.conf.EquipmentClass (which is a subclass from
       generated.gti.conf.EquipmentClass). In this class I can put my
code which will
       be preserved when a new schema is created (because jaxb generates
       generated.gti.conf.EquipmentClass)
3. jaxb should generate methods (when using ID/IDREF) (for typesafety)
    - public void setEquipmentClass(gti.conf.EquipmentClass ec)
    - public gti.conf.EquipmentClass getEquipmentClass()
   It should NOT generate methodes like:
   - public void setEquipmentClass(Object ec)
   - public Object getEquipmentClass()
   - public void setEquipmentClass(generated.gti.conf.EquipmentClass)
!!!!!!!!!!!!
   - public generated.gti.conf.EquipmentClass getEquipmentClass()

I've managed to get 1 and 2 working in jaxb 1.0 with the annotation
<jxb:class implClass>
and the binding <jxb:schemaBindings><jxb:package
name="generated.gti.conf"/>. (I don't
like this very much but it works).
I haven't got 3 working. Are there any ways? and in jaxb 2.0?

Kees.





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net