This content has been marked as final. Show 2 replies
I develop a web app which has it model classes in a separate jar that also contains the hbm.xml files for mapping the entities. The entities are accessed through standard JPA EntityManager. There are both query and home components declared in components.xml:
<framework:entity-query name="subsystemList" ejbql="select s from CaasSubsystem s" max-results="1000" />
<framework:entity-home name="subsystemHome" entity-class="com.comptel.cs.caas.pojo.CaasSubsystem" />
Everything goes fine until I delete an entity with the home component. Then Seam.getEntityClass gets invoked and returns null, which in turn causes the following:
Caused by: java.lang.IllegalArgumentException: Not an entity class: com.comptel.cs.caas.pojo.CaasSubsystem
This is because the Seam.getEntityClass checks for @javax.persisence.Entity annotation or ejb3 xml mapping, but it does not take into account that entities can mapped by hbm.xml files too.
I tried using hibernate-entity-home and hibernate-entity-query components , but it did not help, but the exception occurred more often, not only after invoking remove on the entity home component.
Annotating my classes with @Entity (which are mapped in *.hbm.xml!) helped, but it not a correct solution, because there might be some cases when the classes in the model package cannot be changed.
Has anyone any idea how to work this around?