Help with Enumerations & Class Diagram


I am having trouble generating code from a class diagram that uses enumerations.

A class i’ve created must have an attribute that will contain a value from an enumeration. I have a class called Cart that should have an attribute named codeType. The value of the codeType must be one of the values defined in an Enumeration.

My class diagram is looking like this:

Using the Wizard from Tools->ORM->Wizards I attempt to generate the Java code for this. The code generation fails with the message: Please synchronize association between Cart and CartCodeTypes classes.

How do I make this work? The bottom line is that i’d like to constrain the values of a class attribute to a set of values I define. I’m attempting to do this by using an enumeration, but are there other/better solutions?

Thanks for any help.

Hi amareto,

Thank you for your post. This is not supported at the moment. Because the persistable data type must be the allowed types (string, int…), can’t be a user-defined class like “CartCodeTypes”.

But for the data model side, you can define enumeration type by filling in the User Type text field of column. For details, please read:

Best regards,