Ilya
Ilya

Reputation: 29693

Java EE Example not working

In this doc we can see example of usage @CollectioTable annotation

I wrote the same code

@Entity public class Person {
       @ElementCollection
       @CollectionTable(name="HOMES", joinColumns = @Column(name = "PERSON_ID"))  
       @Column(name="HOME_STATE")
       protected List<String> vacationHomes;
       ...
    }  

Usinf Hibernate-jpa-2 version 1.0.0.Final

Deploy on JBoss 4.3.0.GA

And get exception (while deploying), that column HOME_STATE cann't be mapped on java.util.List

so I change List to ArrayList

After that application was deployed well.
But doesn't work well! I execute simple query, but annotations @ElementCollection and @CollectionTable were ignored! Working only @Column annotation

Can be problem with old JBoss version?
I don't know where problem...

Upvotes: 0

Views: 264

Answers (1)

Mikko Maunu
Mikko Maunu

Reputation: 42084

Features that are part of JPA 2.0 are not working. That's because of missing implementation. In this case, only new annotations are there, but no processing (hibernate-jpa-2.0-api-1.0.0.Final is only JPA 2.0 interface, not the implementation).

According releases notes JBoss 4.3.0.GA was shipped with Hibernate 3.2.1, which is not JPA 2.0 implementation.

Making it work is next from impossible also with JBoss 5, as you can read from this question. If you cannot update at least to the JBoss 6.x, then it is easier to stick with JPA 1.

Upvotes: 3

Related Questions