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