hello Werner, sorry to reply so late, I'm absent from work yesterday.
I'm currently using Castor in the scope of implementing web service using XFire and Castor. I'm sorry if i confused you with my first question. About my first question, its more like a hibernate and Castor issue than XFire issues. As i mentioned earlier, i'm creating a webservice. I'm trying to expose my domain class to outside actor using this webservice. my approach is to create an xml schema that define my domain class structure. Currently i'm using Hibernate ORM to persist/load my domain class from the database. Now, if i generate the java class from my schema, the generated class from castor will override my domain class, that i already generate using hibernate. What i want to know, is there anyway to let castor know, to reuse my existing class, instead of generating it. Another approach would be generating the schema, and then manually refactoring java import to point to my hibernate class instead of castor generated files. I think this should work because both classes is POJO style. Last effort would be to create a clone method, that copy from/to each domain class. For the second question, i totally agree with you. Thats why i called my solution a hack :) Thanks for the alternative , i really appreciate it, i've submitted a jira request for this. On 6/19/07, Werner Guttmann < [EMAIL PROTECTED]> wrote:
Not sure about your first question, to be honest, as I don't know anything about xfire and how it internally makes use of Castor. But lewt me try to address the second question. The isValid() method is a convenience method to 'ask' Castor to verify whether a given domain class (a POJO in your speak) can be successfully validated. Internally, this calls the Validator class, and I honestly would not want to add a setter for this (convenience one-way) method, as it would be semantically dead wrong. What I could offer is that no such method be generated during code generation, but you'd have to raise a feature request first (as no such functionality exists right now). abangkis wrote: > Hello, > > I'm currently implementing xfire with castor in my project. my xml > schema look like this > > <?xml version="1.0" encoding="UTF-8"?> > <xs:schema targetNamespace=" http://xfire.codehaus.org/CastorService " > xmlns:tns="http://xfire.codehaus.org/CastorService" xmlns:xs=" > http://www.w3.org/2001/XMLSchema " elementFormDefault="qualified" > attributeFormDefault="unqualified"> > <xs:element name="MReunionProtocol"> > <xs:annotation> > <xs:documentation>Comment describing your root > element</xs:documentation> > </xs:annotation> > <xs:complexType> > <xs:sequence> > <xs:element name="ToR" type="xs:int"/> > <xs:element name="Messages" type="xs:string" > minOccurs="0" maxOccurs="unbounded"/> > <xs:element name="Data" minOccurs="0"> > <xs:complexType> > <xs:choice> > <xs:element name="Contact" > maxOccurs="unbounded"> > <xs:complexType> > <xs:all> > <xs:element name="contactId" > type="xs:int"/> > <xs:element name="User"> > <xs:complexType> > <xs:all> > <xs:element > name="userId" type="xs:int"/> > <xs:element > name="userProfile" type="xs:string"/> > </xs:all> > </xs:complexType> > </xs:element> > <xs:element name="firstName" > type="xs:string"/> > <xs:element name="lastName" > type="xs:string"/> > </xs:all> > </xs:complexType> > </xs:element> > <xs:element name="SynchRequest"> > <xs:complexType> > <xs:sequence> > <xs:element name="Contact" > maxOccurs="unbounded"> > <xs:complexType> > <xs:all> > <xs:element > name="contactId" type="xs:int"/> > <xs:element name="User"> > <xs:complexType> > <xs:all> > > <xs:element name="userId" type="xs:int"/> > > <xs:element name="userProfile" type="xs:string"/> > </xs:all> > </xs:complexType> > </xs:element> > <xs:element > name="firstName" type="xs:string"/> > <xs:element > name="lastName" type="xs:string"/> > </xs:all> > </xs:complexType> > </xs:element> > </xs:sequence> > </xs:complexType> > </xs:element> > </xs:choice> > </xs:complexType> > </xs:element> > <xs:element name="Version" type="xs:string"/> > </xs:sequence> > </xs:complexType> > </xs:element> > </xs:schema> > > and i use Castor to generate the java class. > > My first problem is, the Contact element from my schema is a hibernate > generated POJO class. How can i make generated class to use this class, > instead generating a new contact class? > > My second problem is Castor generated an isValid() method for each java > class. Somehow xfire need both getter/setter for each property of a > class. I've managed to hack this by creating a setValid(boolean valid) > for each class. I was wondering whether there any other way i can avoid > this without have to manually add setValid method for each class. > > > Thanks in Advance > - abangkis - --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email

