-
1. Re: Seam Hibernate with Xml Mappings Instead Of Hibernate Annotations
swd847 Jan 7, 2010 11:54 PM (in response to sangaurav)I assume you have annotated you persistent class with an @Name annotation right?
This causes seam to treat it like a normal component and generate a proxy for it so it can use interceptors etc.You have two options:
1) remove the @Name annotation. This annotation does not really make sense on an entity in anyway, if you need to inject it use a factory method instead.
2) stick an @Entity annotation on the bean and disable the hibernate auto-discovery of annotated beans. This way seam will still realise it is an entity.
-
2. Re: Seam Hibernate with Xml Mappings Instead Of Hibernate Annotations
sangaurav Jan 8, 2010 3:00 PM (in response to sangaurav)Thanks Stuart, I have used first option and my issue gets resolved.
I'm using spring with seam, spring is responsible for creating session factory and loading hibernate mappings. For spring-seam integration i have referred online available chapter from Seam In Action.
I have tried second option but didn't succeed. Even after using @Entity annotation, from Hiberanate API (org.hibernate.annotations.Entity) instead of from JPA (javax.persistence.Entity), the DTO passed in DAO layer is java assist proxy.
Actually i'm not using JPA so i haven't configured persistence.xml, hence i haven't disabled the hibernate auto-discovery of annotated beans.
Please let me know is it the right way to use the second option?