[jboss-user] [JBoss Seam] - How to map an array or a list of enums?
grettke_spdr
do-not-reply at jboss.com
Mon Jun 11 20:20:40 EDT 2007
Hi folks,
In EJB 3.0 via Seam 1.2.1.GA we want to persist an entity with an array of enums.
In the entity
| public UnderwritingConcernEnum[] getConcerns() {
| return concerns;
| }
|
| public void setConcerns(UnderwritingConcernEnum[] concerns) {
| this.concerns = concerns;
| }
|
|
| public enum UnderwritingConcernEnum {
|
| REINSURANCE("Reinsurance", "", "Re"),
| INSUREDS_REQUEST("Insured's Request", "", "IRt"),
| OLDER_ORNATE_STRUCTURE("Older Ornate Structure", "", "OOSe"),
| VALUATION("Valuation", "", "Vn"),
| LIABILTY_ACTIVITIES("Liability Exposures/Activities", "", "LAs"),
| OTHER("Other (Be Specific)", "", "Or");
|
| private final String label;
| private final String description;
| private final String value;
|
| UnderwritingConcernEnum(String label, String description, String value) {
| this.label = label;
| this.description = description;
| this.value = value;
| }
|
| public String getLabel() {
| return label;
| }
|
| public String getDescription() {
| return description;
| }
|
| public String getValue() {
| return value;
| }
| }
|
We have tried using the ordinal enumeration attribute, and also removing it. Either way, this entity will no be persisted failing with the error.
| 18:56:41,484 INFO [STDOUT] Hibernate: insert into Contact (CONTACT_NAME, CONTAC
| T_ROLE, CONTACT_EMAIL, CONTACT_PHONE, CONTACT_TITLE) values (?, ?, ?, ?, ?)
| 18:56:41,515 INFO [STDOUT] Hibernate: insert into Account (priority, totalNumOf
| Buildings, totalBuildingValueFromInForceMP, CONTACT_ID, concerns, cmicAccountNum
| ber, expirationDate, acctName, acctAddress, acctCity, acctState, acctZip, todays
| Date, comments, requestedBy) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
| )
| 18:56:41,531 ERROR [Priority1RequestActionMock] java.lang.ClassCastException: [L
| com.churchmutual.rms.enums.UnderwritingConcernEnum;
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4053307#4053307
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4053307
More information about the jboss-user
mailing list