Hi all,

I have defined an enum in my model file as follows:

--

"Enum denoting the visibility of a recipients address when a message is sent
to one or more recipients"
        enum AddressingVisibility {
            String code key
            TO ("to"),
            CC ("cc"),
            BCC ("bcc")
        }

--

I have a reference to this enum in one of my entities:

--

   "The Message Entity"
        Entity Message {

            .
            .
            - @AddressingVisibility addressVisibility nullable
            .
            .
     }

--


My code is generated properly and the project compiles without any errors.
However, when I run my tests I get the following error:


--

Caused by: org.hibernate.MappingException: Could not determine type for:
AddressingVisibility, at table: MESSAGE, for columns:
[org.hibernate.mapping.Column(ADDRESSVISIBILITY)]
        at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:292)
        at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:276)
        at org.hibernate.mapping.Property.isValid(Property.java:207)
        at 
org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:458)
        at org.hibernate.mapping.RootClass.validate(RootClass.java:215)
        at org.hibernate.cfg.Configuration.validate(Configuration.java:1135)
        at
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1320)
        at
org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
        at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
        ... 58 more

--

I have checked the files generated and all seems well ...
applicationContext-test.xml has a reference to EntityManagerFactory-test.xml
which has a reference to persistence-test.xml which has a reference to
hibernate.cfg.xml which contains a reference to the EnumsXXXX.hbm.xml which
contains the definitions of my Enums. PS: The problem I am having is with
all enums (tried removing the one mentioned here ...). The enum giving the
error happens to be the very first one to be 'started'.

Something else, which is quite weird is that these same tests work when I
run them from within my IDE (IntelliJ). (They fail when I run 'mvn clean
install').


Thanks for any help ...

Regards
Chris

-- 
View this message in context: 
http://old.nabble.com/Hibernate-MappingException-for-Enums.-tp29965294s17564p29965294.html
Sent from the Fornax-Platform mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Fornax-developer mailing list
Fornax-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fornax-developer

Reply via email to