-
1. Re: Application Framework: EntityHome and EntityQuery
lightguard Oct 20, 2011 4:54 PM (in response to kwutzke)We're still debating it a bit. We actually need to get a sticky in place with the info. You can look through archives of the seam-dev mailing list for what we have talked about.
-
2. Re: Application Framework: EntityHome and EntityQuery
blabno Dec 8, 2011 5:20 AM (in response to kwutzke)We've ported classes from seam2 and added some minor enhencements. In 2 weeks I will blog about new features and how to use EntityHome and EntityQuery as real DAO decoupled from view layer.
-
3. Re: Application Framework: EntityHome and EntityQuery
blabno Dec 12, 2011 1:24 AM (in response to kwutzke)btw. if you're interested in source code: http://it-crowd.com.pl/svn/seam3-persistence-framework/trunk.
-
4. Re: Application Framework: EntityHome and EntityQuery
cankara Dec 19, 2011 5:59 AM (in response to kwutzke)Bernard, i can not use your library with seam 3 booking-example. Can i exclude some of your dependencies or all of them because they are used in booking example too. I need your help please!
Dependencies, which seam booking-example uses:
<dependency>
<groupId>org.jboss.solder</groupId>
<artifactId>solder-tooling</artifactId>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jboss.solder</groupId>
<artifactId>solder-impl</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>${jpamodelgen.version}</version>
<scope>provided</scope>
<!-- Excluded Hibernate-provided JPA API because it's provided by the Java EE 6 dependencies -->
<exclusions>
<exclusion>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.seam.faces</groupId>
<artifactId>seam-faces</artifactId>
<scope>compile</scope><!-- Temporary workaround for GLASSFISH-17184 -->
</dependency>
<dependency>
<groupId>org.jboss.seam.international</groupId>
<artifactId>seam-international</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.seam.security</groupId>
<artifactId>seam-security</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jboss.seam.transaction</groupId>
<artifactId>seam-transaction</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-core</artifactId>
<version>1.5.0.Alpha02</version>
</dependency>
<dependency>
<groupId>com.ocpsoft</groupId>
<artifactId>ocpsoft-pretty-time</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>com.ocpsoft</groupId>
<artifactId>prettyfaces-jsf2</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
<version>2.1</version>
</dependency>
<!-- Bean Validation Implementation; provides portable constraints @NotEmpty, @Email and @Url -->
<!-- Hibernate Validator is the only JSR-303 implementation at the moment, so we can assume it's provided -->
<!-- TODO Move Hibernate Validator to app server specific sections -->
<dependency>
<groupId>org.hibernate.</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.1.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<type>pom</type>
<scope>provided</scope>
</dependency> -
5. Re: Application Framework: EntityHome and EntityQuery
cankara Dec 19, 2011 6:18 AM (in response to kwutzke)I get this exception, if i deploy my applicaton:
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [EntityManager] with qualifiers [@Default] at injection point [[field] @Inject private pl.com.it_crowd.seam.framework.converter.EntityConverter.entityManager] -
6. Re: Application Framework: EntityHome and EntityQuery
blabno Dec 19, 2011 11:57 AM (in response to kwutzke)If you have in your app a different version of one of those artifacts then you may exclude them.
As to the exception you have no SMPC defined i guess.
-
7. Re: Application Framework: EntityHome and EntityQuery
cankara Dec 20, 2011 4:20 AM (in response to kwutzke)Thank you for your reply.
I changed the annotation in class pl.com.it_crowd.seam.framework.converter.EntityConverter as follows:
from
@Inject
private EntityManager entityManager;
to
@PersistenceContext
private EntityManager entityManager;
I could deploy it.
But now i get this exception, if i want to persist something which extends EntityHome:
org.jboss.weld.exceptions.UnsatisfiedResolutionException: WELD-001308 Unable to resolve any beans for Types: [interface javax.persistence.EntityManager]; Bindings: [@javax.enterprise.inject.Default()]
at org.jboss.weld.manager.BeanManagerImpl.getBean(BeanManagerImpl.java:707)
at org.jboss.weld.bean.builtin.InstanceImpl.get(InstanceImpl.java:96)
at de.persistence.EntityHome.getEntityManager(EntityHome.java:55)
at de.persistence.EntityHome.joinTransaction(EntityHome.java:125)
at de.persistence.Home.getInstance(Home.java:124)
I use @PersistenceContext to inject an EntityManager, because the seam 3 booking-example uses it and because i have only one persistence unit.
Should i change it to SMPC and how? -
8. Re: Application Framework: EntityHome and EntityQuery
blabno Dec 20, 2011 11:39 AM (in response to kwutzke)You should inject the EntityManager as you do in other beans. It should work with @PersistenceContext if you use it.
-
9. Re: Application Framework: EntityHome and EntityQuery
clementlalanne Jun 21, 2012 6:14 AM (in response to kwutzke)Hello Bernard and Can.
I'm trying to migrate a Seam 2 application to Seam 3 and I have the same issues as Can had. So I changed :
@Inject
private EntityManager entityManager;
to
@PersistenceContext
private EntityManager entityManager;
in EntityConverter.java, and
@Inject
protected Instance<EntityManager> entityManagerInstance;
to
@PersistenceContext
protected Instance<EntityManager> entityManagerInstance;
in EntityHome.java.
When running my code I get the following exception :
java.lang.IllegalArgumentException: Can not set javax.enterprise.inject.Instance field pl.com.it_crowd.seam.framework.EntityHome.entityManagerInstance to org.jboss.as.jpa.container.TransactionScopedEntityManager
Here is my beanHome declaration :
@Named("clientHome")
@ConversationScoped
public class ClientHome extends EntityHome<Client> {
...
}
do you have any ideas?
Thanks,
Clément
-
10. Re: Application Framework: EntityHome and EntityQuery
gkarakoc Jun 21, 2012 7:19 AM (in response to clementlalanne)Hi Clément,
if you use seam managed persistence context (SMPC) you don't need change the annotation to @PersistenceContext.
http://seamframework.org/Seam3/PersistenceModule
http://docs.jboss.org/seam/3/persistence/latest/reference/en-US/html_single/#d0e211
-
11. Re: Application Framework: EntityHome and EntityQuery
clementlalanne Jun 21, 2012 9:38 AM (in response to kwutzke)Thanks for your fast answer Gurcan.
I tried to set a SMPC but I get the same exceptions as before.
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [EntityManager] with qualifiers [@Default] at injection point [[field] @Inject private pl.com.it_crowd.seam.framework.converter.EntityConverter.entityManager]
maybe I'm doing it wrong :
public class EntityManagerProducer
{
@ExtensionManaged
@Produces
@PersistenceUnit(unitName = "oraclePU")
@Dependent
EntityManagerFactory producerField;
}
Do I have to declare something in beans.xml or web.xml ?
I tried many things according to topics on the forum, but none of them worked..
what do you think ?
Clément
-
12. Re: Application Framework: EntityHome and EntityQuery
blabno Jun 21, 2012 10:58 AM (in response to clementlalanne)No beans.xml nor web.xml modifications are required. Are you sure that you bundle seam-persistence-impl with your app?
-
13. Re: Application Framework: EntityHome and EntityQuery
clementlalanne Jun 21, 2012 11:50 AM (in response to kwutzke)Thanks,
actually yes, seam-persistence-impl was missing...
Now I'm fighting against several exceptions at deployment. I think they are dependencies exceptions like this one :
org.jboss.weld.exceptions.DeploymentException: WELD-001409 Ambiguous dependencies for type [ELContext] with qualifiers [@Default] at injection point [[parameter 1] of [constructor] @Inject public org.jboss.solder.el.Expressions(ELContext, ExpressionFactory)]. Possible dependencies [[Producer Method [ELContext] with qualifiers [@Any @Default] declared as [[method] @Produces org.jboss.solder.el.ELContextProducer.createELContext()], Producer Method [ELContext] with qualifiers [@Any @Default] declared as [[method] @Produces org.jboss.seam.solder.el.ELContextProducer.createELContext()]]... I'm working on it
-
14. Re: Application Framework: EntityHome and EntityQuery
clementlalanne Jun 22, 2012 8:28 AM (in response to kwutzke)I realized that my pom.xml was a terrible mess. After fixing it, everything is working fine !
Thanks for your help !