[jbossseam-issues] [JBoss JIRA] Updated: (JBSEAM-1792) Configure PersistenceContextName in EntityHome/EntityQuery using annotation
Pete Muir (JIRA)
jira-events at lists.jboss.org
Mon Aug 13 16:41:01 EDT 2007
[ http://jira.jboss.com/jira/browse/JBSEAM-1792?page=all ]
Pete Muir updated JBSEAM-1792:
------------------------------
Fix Version/s: (was: 2.0.0.BETA1)
> Configure PersistenceContextName in EntityHome/EntityQuery using annotation
> ---------------------------------------------------------------------------
>
> Key: JBSEAM-1792
> URL: http://jira.jboss.com/jira/browse/JBSEAM-1792
> Project: JBoss Seam
> Issue Type: Patch
> Components: Core
> Affects Versions: 1.2.1.GA, 2.0.0.BETA1
> Reporter: Thomas Neumann
> Priority: Minor
> Attachments: persistenceContextAnnotation.patch
>
> Original Estimate: 10 minutes
> Remaining Estimate: 10 minutes
>
> Classes extending EntityHome/EntityQuery can configure the used persistenceContext by overriding getPersistenceContextName returning the desired ContextName. This is a patch proposing the use of @PersistenceContext(name="foo") to set the desired context name:
> <<snip
> diff -Naur jboss-seam-2.0.0.BETA1/src/main/org/jboss/seam/framework/EntityHome.java jboss-seam-2.0.0.BETA1.patched/src/main/org/jboss/seam/framework/EntityHome.java
> --- jboss-seam-2.0.0.BETA1/src/main/org/jboss/seam/framework/EntityHome.java 2007-06-27 08:37:14.000000000 +0200
> +++ jboss-seam-2.0.0.BETA1.patched/src/main/org/jboss/seam/framework/EntityHome.java 2007-08-13 11:46:41.000000000 +0200
> @@ -1,6 +1,7 @@
> package org.jboss.seam.framework;
>
> import javax.persistence.EntityManager;
> +import javax.persistence.PersistenceContext;
>
> import org.jboss.seam.annotations.Transactional;
> import org.jboss.seam.persistence.PersistenceProvider;
> @@ -98,7 +99,10 @@
> @Override
> protected String getPersistenceContextName()
> {
> - return "entityManager";
> + final PersistenceContext ctx =
> + getClass().getAnnotation(PersistenceContext.class);
> +
> + return null == ctx ? "entityManager" : ctx.name();
> }
>
> }
> diff -Naur jboss-seam-2.0.0.BETA1/src/main/org/jboss/seam/framework/EntityQuery.java jboss-seam-2.0.0.BETA1.patched/src/main/org/jboss/seam/framework/EntityQuery.java
> --- jboss-seam-2.0.0.BETA1/src/main/org/jboss/seam/framework/EntityQuery.java 2007-06-27 08:37:14.000000000 +0200
> +++ jboss-seam-2.0.0.BETA1.patched/src/main/org/jboss/seam/framework/EntityQuery.java 2007-08-13 11:47:16.000000000 +0200
> @@ -4,6 +4,7 @@
> import java.util.Map;
>
> import javax.persistence.EntityManager;
> +import javax.persistence.PersistenceContext;
>
> import org.jboss.seam.annotations.Transactional;
> import org.jboss.seam.persistence.QueryParser;
> @@ -128,7 +129,10 @@
> @Override
> protected String getPersistenceContextName()
> {
> - return "entityManager";
> + final PersistenceContext ctx =
> + getClass().getAnnotation(PersistenceContext.class);
> +
> + return null == ctx ? "entityManager" : ctx.name();
> }
>
> protected javax.persistence.Query createQuery()
> <<snep
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the seam-issues
mailing list