Bunson,

can you please open a new issue at jira and attach a minimal junit test
that allows me to reproduce things. By minimal i think of a test class,
enum, 2 or 3 entities, mapping, jdo-conf and database script in an archive.

Regards
Ralf


Dr. Bunsen Honeydew schrieb:
> 
> 
> Ralf Joachim-2 wrote:
>> Hi Bunson,
>>
>> for Castor JDO the mapping of a enum should look like:
>>
>> <field name="instructionType"
>>        type="de.jsci.apkon.manager.entity.InstructionType">
>>     <sql name="AMRD_INST_TYPE" type="varchar"/>
>> </field>
>>
>> InstructionType is a enum style class in my case but things should also
>> work with Java 5 enums. As far as I recall from top of my head Castor
>> will try to search a mapping for InstructionType which can not be found.
>> It then checks if InstructionType has a static method like:
>>
>> public static InstructionType valueOf(String value);
>>
>> If this method is present it will accept InstructionType as enum.
>>
>> Hope this help.
>> Ralf
>>
>>
>> Dr. Bunsen Honeydew schrieb:
>>> Hi all, First post which I hope will have a simple solution. I have
>>> renamed packages and names for simplicity: I have generated castor
>>> classes from an XSD and a number of fields are defined as xs:restriction
>>> types as follows: */ /* Its configured to use Java 5 enums in the
>>> castorbuilder.properties as follows:
>>> /*org.exolab.castor.builder.javaVersion=5.0
>>> org.exolab.castor.builder.forceJava4Enums=false*/ This results in the
>>> java class that contains an enum of 'Male' & 'Female' with a private
>>> constructor. /*public enum Gender implements java.io.Serializable {
>>> ...*/ As a result, in order to construct this object, you have use the
>>> fromValue method and not the constructor which is private. In the JDO
>>> mapping I have tried a mapping similar to the following: /* */ >From my
>>> java code I call oql = db.getOQLQuery("CALL GetICFTradeBulkMessageData()
>>> AS com.blah.blah.blah.myApp"); results = oql.execute(); but I get
>>> /*org.exolab.castor.mapping.MappingException: The return type for method
>>> public com.blah.blah.blah.types.Gender1
>>> com.blah.blah.blah.myApp.getGenderType() does not match the declared
>>> field type java.lang.String*/ Is this to do with the fact this is an
>>> enum object and doesn't have a default constructor? What am I
>>> missing/doing wrong. Any help appriciated ;-)
>>> ------------------------------------------------------------------------
>>> View this message in context: Castor JDO, stored procedures and using
>>> xs:restriction types
>>> <http://www.nabble.com/Castor-JDO%2C-stored-procedures-and-using-xs%3Arestriction-types-tp18279611p18279611.html>
>>> Sent from the Castor - User mailing list archive
>>> <http://www.nabble.com/Castor---User-f2411.html> at Nabble.com.
>> -- 
>>
>> Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
>> Ralf Joachim
>> Raiffeisenstraße 11
>> 72127 Kusterdingen
>> Germany
>>
>> Tel.   +49 7071 3690 52
>> Mobil: +49 173 9630135
>> Fax    +49 7071 3690 98
>>
>> Internet: www.syscon.eu
>> E-Mail: [EMAIL PROTECTED]
>>
>> Sitz der Gesellschaft: D-72127 Kusterdingen
>> Registereintrag: Amtsgericht Stuttgart, HRB 382295
>> Geschäftsleitung: Jens Joachim, Ralf Joachim
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>>
> 
> Thanks for the reply Ralf.
> Got dragged off and other things so only just coming back to this issue.
> Looks like I'm on the right tracks, but still get an error as below:
> 
> org.exolab.castor.jdo.DataObjectAccessException: Type conversion error:
> could not set value of FieldMolder for com.blah.blah.blah.GenderType of type
> com.blah.blah.blah.types.GenderType1 with value of type java.lang.String
> 
> My Mapping is as follows:
> 
> <field name="blah.GenderType" type="com.blah.blah.blah.types.GenderType1">
>                       <sql name="Gender" type="varchar"/>
> </field>
> 
> Where does it get the idea of a String in the error message? Is that from
> the Varchar?
> 
> The enum is generated by castor generator from an xsd and I have tried
> setting the enum in code with the allowed strings using valueOf("FEMALE")
> successfully.
> 
> I have a simple hard coded proc for test purposes compiled in Sybase that
> simply returns some values
> 
> create procedure TestProc 
> as
>  select  '9999999999999999', getdate(), 'FEMALE', '123456789', '987654321',
> 'ABCD1234567890', '27.81'
> ...
> 
> I'll keep plugging away, but if anyone has any suggestions ;-)
> Thanks

-- 

Syscon Ingenieurbüro für Meß- und Datentechnik GmbH
Ralf Joachim
Raiffeisenstraße 11
72127 Kusterdingen
Germany

Tel.   +49 7071 3690 52
Mobil: +49 173 9630135
Fax    +49 7071 3690 98

Internet: www.syscon.eu
E-Mail: [EMAIL PROTECTED]

Sitz der Gesellschaft: D-72127 Kusterdingen
Registereintrag: Amtsgericht Stuttgart, HRB 382295
Geschäftsleitung: Jens Joachim, Ralf Joachim

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to