You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by membersound <me...@web.de> on 2012/11/09 18:03:25 UTC

Negate a triggerfragment?

Hi,

how can I negate a triggerfragment? So that it only shows up if checkbox is
/un/checked?
Especially: why does the following not work?
<t:checkbox t:id="checkbox" value="object.bool" t:mixins="triggerfragment"
fragment="frag"/>
<t:formfragment t:id="frag" visible="!object.bool">

It initially does not show the fragment (as default value of object.bool =
true). But if I uncheck the checkbox, it does not trigger the fragment. BUT
if I then check the checkbox again (which should intentionally hide the
fragment) it is shown instead!

class Page {
   @Property
   @Persist
   Object object;
}

class Object {
   boolean bool = true;
}


What's wrong here?



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Negate-a-triggerfragment-tp5717884.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: tapestry-jpa entities not associated with correct entity manager

Posted by John <jo...@quivinco.com>.
I'm disappointed that the class elements in the persistence.xml are not being used!

I did see a post mentioning that when there are multiple persistence units the entities package is not scanned, but clearly it is on lazy loading the first entity manager. I also read that PersistenceUnitConfigurer needs to be contributed in these cases*, but what does that look like?

John

* source http://tapestry.1045711.n5.nabble.com/Problems-accessing-Named-Queries-in-multiple-Persistent-Units-td4578677.html

  ----- Original Message ----- 
  From: Lenny Primak 
  To: Tapestry users 
  Cc: Tapestry users 
  Sent: Sunday, November 11, 2012 4:30 PM
  Subject: Re: tapestry-jpa entities not associated with correct entity manager


  I would suggest either using or looking at FlowLogix tapestry library
  It has a jpa package that takes care of using multiple persistence units in one application. 
  The key is to have entities with different PUs in different packages. 

  On Nov 11, 2012, at 3:49 AM, "John" <jo...@quivinco.com> wrote:

  > I'm finding that entities are not being attached to the correct entity manager even though they are indicated in the persistence.xml.
  > 
  > This manifests that if the user logs in first which uses AuditDBUnit then the entities in JabberDBUnit are not available. If the JabberDBUnit is used first, entities are not available from the other units.
  > 
  > Is there a way to ensure the entities associate with the right persistence units?
  > 
  > regards,
  > John
  > 
  > <?xml version="1.0" encoding="UTF-8"?>
  > <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
  > 
  >   <persistence-unit name="JabberDBUnit" transaction-type="RESOURCE_LOCAL">
  >       <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
  >       <class>com..audit.manager.entities.JabberUser</class>
  >       <properties>
  >          <property name="javax.persistence.jdbc.driver"     value="org.postgresql.Driver" />
  >          <property name="javax.persistence.jdbc.url"        value="jdbc:postgresql://212.95.225.52:5432/jsm" />
  >          <property name="javax.persistence.jdbc.user"       value="com." />
  >          <property name="javax.persistence.jdbc.password"   value="com." />
  >          <property name="eclipselink.logging.level"         value="fine"/>
  >      </properties>
  >   </persistence-unit>
  > 
  >   <persistence-unit name="AuditDBUnit" transaction-type="RESOURCE_LOCAL">
  >       <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
  >       <class>com..audit.manager.entities.ValidateUsernameBean</class>
  >       <class>com..audit.manager.entities.UsersWhoCanLogIn</class>
  >       <properties>
  >          <property name="javax.persistence.jdbc.driver"     value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
  >          <property name="javax.persistence.jdbc.url"        value="jdbc:sqlserver://212.95.225.51:1433;databaseName=eAudit" />
  >          <property name="javax.persistence.jdbc.user"       value="webserver" />
  >          <property name="javax.persistence.jdbc.password"   value="epu1s3" />
  >          <property name="eclipselink.logging.level"         value="fine"/>
  >      </properties>
  >   </persistence-unit>
  > 
  >   <persistence-unit name="IMAuditDBUnit" transaction-type="RESOURCE_LOCAL">
  >       <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
  >       <properties>
  >          <property name="javax.persistence.jdbc.driver"     value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
  >          <property name="javax.persistence.jdbc.url"        value="jdbc:sqlserver://212.95.225.51:1433;databaseName=eIMAudit" />
  >          <property name="javax.persistence.jdbc.user"       value="webserver" />
  >          <property name="javax.persistence.jdbc.password"   value="epu1s3" />
  >          <property name="eclipselink.logging.level"         value="fine"/>
  >      </properties>
  >   </persistence-unit>
  > 
  > </persistence>

  ---------------------------------------------------------------------
  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
  For additional commands, e-mail: users-help@tapestry.apache.org

Re: tapestry-jpa entities not associated with correct entity manager

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
It requires java 7 to work.  



On Nov 12, 2012, at 4:18 PM, "John" <jo...@quivinco.com> wrote:

> Thanks for this library.
> 
> I tried the FlowLogix 1.1.7 library with my Tapestry 5.3.6 project and get this on jetty startup:
> 
> java.lang.UnsupportedClassVersionError: com/flowlogix/web/services/ServicesModul
> e : Unsupported major.minor version 51.0
>        at java.lang.ClassLoader.defineClass1(Native Method)
>        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
>        at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
>        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14
> 1)
>        at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
>        at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
>        at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>        at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoade
> r.java:392)
>        at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoade
> r.java:363)
>        at java.lang.Class.forName0(Native Method)
>        at java.lang.Class.forName(Class.java:247)
>        at org.apache.tapestry5.ioc.RegistryBuilder.add(RegistryBuilder.java:157
> )
>        at org.apache.tapestry5.ioc.IOCUtilities.addModulesInList(IOCUtilities.j
> ava:137)
>        at org.apache.tapestry5.ioc.IOCUtilities.addModulesInManifest(IOCUtiliti
> es.java:107)
>        at org.apache.tapestry5.ioc.IOCUtilities.addDefaultModules(IOCUtilities.
> java:77)
>        at org.apache.tapestry5.internal.TapestryAppInitializer.<init>(TapestryA
> ppInitializer.java:124)
>        at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:103)
>        at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
>        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
> 50)
>        at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.ja
> va:653)
>        at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
> 
>  ----- Original Message ----- 
>  From: Lenny Primak 
>  To: Tapestry users 
>  Sent: Monday, November 12, 2012 3:39 PM
>  Subject: Re: tapestry-jpa entities not associated with correct entity manager
> 
> 
>  Yes, I have multiple PUs working correctly, using Glassfish and the FlowLogix library:
> 
>  Here are some references:
>  http://code.google.com/p/flowlogix/wiki/TLPersistenceRegistry
> 
> 
>  On Nov 12, 2012, at 6:56 AM, John wrote:
> 
>> This did not work either, even though the config code is called! Has anyone got multiple persistence units working please, if so how?
>> 
>> @Contribute(EntityManagerSource.class)
>> public static void configurePersistenceUnitInfos(
>>  MappedConfiguration<String, PersistenceUnitConfigurer> cfg,
>>  final Logger log) {
>> PersistenceUnitConfigurer jabberConfigurer = new PersistenceUnitConfigurer() {
>>  public void configure(TapestryPersistenceUnitInfo unitInfo) {
>>   unitInfo.addManagedClass(com.audit.manager.jabber.entities.JabberUser.class);
>>   log.info("JabberDBUnit classes added");
>>  }
>> };
>> cfg.add("JabberDBUnit", jabberConfigurer);
>> PersistenceUnitConfigurer auditConfigurer = new PersistenceUnitConfigurer() {
>>  public void configure(TapestryPersistenceUnitInfo unitInfo) {
>>   unitInfo.addManagedClass(com.audit.manager.audit.entities.ValidateUsernameBean.class);
>>   unitInfo.addManagedClass(com.audit.manager.audit.entities.UsersWhoCanLogIn.class);
>>   log.info("AuditDBUnit classes added");
>>  }
>> };
>> cfg.add("AuditDBUnit", auditConfigurer);
>> }
>> 
>> [ERROR] TapestryModule.RequestExceptionHandler Processing of request failed with
>> uncaught exception: Unknown entity bean class: class com.audit.manager.audit
>> .entities.UsersWhoCanLogIn, please verify that this class has been marked with t
>> he @Entity annotation.
>> org.apache.tapestry5.runtime.ComponentEventException: Unknown entity bean class:
>> class com..audit.manager.audit.entities.UsersWhoCanLogIn, please verify that
>> this class has been marked with the @Entity annotation. [at classpath:com./aud
>> it/manager/pages/Login.tml, line 7]
>> 
>> package com.audit.manager.audit.entities;
>> 
>> import java.io.Serializable;
>> 
>> import javax.persistence.Column;
>> import javax.persistence.Entity;
>> import javax.persistence.Id;
>> import javax.persistence.Table;
>> 
>> @Entity
>> @Table(name = "v_UsersWhoCanLogIn")
>> public class UsersWhoCanLogIn implements Serializable {
>> 
>> private static final long serialVersionUID = 803545730972339902L;
>> 
>> @Id
>> @Column(name = "username")
>> private String username;
>> ----- Original Message ----- 
>> From: Lenny Primak 
>> To: Tapestry users 
>> Cc: Tapestry users 
>> Sent: Sunday, November 11, 2012 4:30 PM
>> Subject: Re: tapestry-jpa entities not associated with correct entity manager
>> 
>> 
>> I would suggest either using or looking at FlowLogix tapestry library
>> It has a jpa package that takes care of using multiple persistence units in one application. 
>> The key is to have entities with different PUs in different packages. 
>> 
>> On Nov 11, 2012, at 3:49 AM, "John" <jo...@quivinco.com> wrote:
>> 
>>> I'm finding that entities are not being attached to the correct entity manager even though they are indicated in the persistence.xml.
>>> 
>>> This manifests that if the user logs in first which uses AuditDBUnit then the entities in JabberDBUnit are not available. If the JabberDBUnit is used first, entities are not available from the other units.
>>> 
>>> Is there a way to ensure the entities associate with the right persistence units?
>>> 
>>> regards,
>>> John
>>> 
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
>>> 
>>> <persistence-unit name="JabberDBUnit" transaction-type="RESOURCE_LOCAL">
>>>     <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
>>>     <class>com..audit.manager.entities.JabberUser</class>
>>>     <properties>
>>>        <property name="javax.persistence.jdbc.driver"     value="org.postgresql.Driver" />
>>>        <property name="javax.persistence.jdbc.url"        value="jdbc:postgresql://212.95.225.52:5432/jsm" />
>>>        <property name="javax.persistence.jdbc.user"       value="com." />
>>>        <property name="javax.persistence.jdbc.password"   value="com." />
>>>        <property name="eclipselink.logging.level"         value="fine"/>
>>>    </properties>
>>> </persistence-unit>
>>> 
>>> <persistence-unit name="AuditDBUnit" transaction-type="RESOURCE_LOCAL">
>>>     <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
>>>     <class>com..audit.manager.entities.ValidateUsernameBean</class>
>>>     <class>com..audit.manager.entities.UsersWhoCanLogIn</class>
>>>     <properties>
>>>        <property name="javax.persistence.jdbc.driver"     value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
>>>        <property name="javax.persistence.jdbc.url"        value="jdbc:sqlserver://212.95.225.51:1433;databaseName=eAudit" />
>>>        <property name="javax.persistence.jdbc.user"       value="webserver" />
>>>        <property name="javax.persistence.jdbc.password"   value="epu1s3" />
>>>        <property name="eclipselink.logging.level"         value="fine"/>
>>>    </properties>
>>> </persistence-unit>
>>> 
>>> <persistence-unit name="IMAuditDBUnit" transaction-type="RESOURCE_LOCAL">
>>>     <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
>>>     <properties>
>>>        <property name="javax.persistence.jdbc.driver"     value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
>>>        <property name="javax.persistence.jdbc.url"        value="jdbc:sqlserver://212.95.225.51:1433;databaseName=eIMAudit" />
>>>        <property name="javax.persistence.jdbc.user"       value="webserver" />
>>>        <property name="javax.persistence.jdbc.password"   value="epu1s3" />
>>>        <property name="eclipselink.logging.level"         value="fine"/>
>>>    </properties>
>>> </persistence-unit>
>>> 
>>> </persistence>
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>  For additional commands, e-mail: users-help@tapestry.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


PATCH: tapestry-jpa EntityManagerObjectProvider fixes entities not associated with correct entity manager issue

Posted by John <jo...@quivinco.com>.
This looks like a bug where a class member variable is used to cache the EntityManager that is subsequently handed to all the PersistenceContext annotations regardless of the unitName, like I said.

The following replacement class is tested working and handles multiple persistence units correctly as per the original Tapestry docs, just put it on your classpath first. Maybe someone on the developer side can check this out and commit it to the build cycle.


package org.apache.tapestry5.internal.jpa;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.apache.tapestry5.ioc.AnnotationProvider;
import org.apache.tapestry5.ioc.ObjectCreator;
import org.apache.tapestry5.ioc.ObjectLocator;
import org.apache.tapestry5.ioc.ObjectProvider;
import org.apache.tapestry5.ioc.services.PlasticProxyFactory;
import org.apache.tapestry5.jpa.EntityManagerManager;

/**
 * A patched version to use PlasticProxyFactory and not cache the EntityManager as a class member.
 * @author John Coleman
 */
public class EntityManagerObjectProvider implements ObjectProvider
{

    /**
     * {@inheritDoc}
     */
    public <T> T provide(final Class<T> objectType, final AnnotationProvider annotationProvider,
            final ObjectLocator locator)
    {
        if (objectType.equals(EntityManager.class))
            return objectType.cast(getOrCreateProxy(annotationProvider, locator));

        return null;
    }

    private synchronized EntityManager getOrCreateProxy(
            final AnnotationProvider annotationProvider, final ObjectLocator objectLocator)
    {
            final PlasticProxyFactory proxyFactory = objectLocator.getService("PlasticProxyFactory",
              PlasticProxyFactory.class);

             final PersistenceContext annotation = annotationProvider
                            .getAnnotation(PersistenceContext.class);

            EntityManager proxy = proxyFactory.createProxy(EntityManager.class, new ObjectCreator<EntityManager>()
            {
                public EntityManager createObject()
                {
                    final EntityManagerManager entityManagerManager = objectLocator
                            .getService(EntityManagerManager.class);

                    return JpaInternalUtils.getEntityManager(entityManagerManager, annotation);
                }
            }, "<EntityManagerProxy>");

        return proxy;
    }

}

Re: tapestry-jpa entities not associated with correct entity manager

Posted by lp...@hope.nyc.ny.us.
I suggest you upgrade to Java 7, it works perfectly with no compatibility issues, and is a lot faster.But, if you insist on not doing it, you can look at the source code and figure out how it works.It's not that much code.John  wrote:&gt; Thanks for this library.&gt; &gt; I tried the FlowLogix 1.1.7 library with my Tapestry 5.3.6 project and get this on jetty startup:&gt; &gt; java.lang.UnsupportedClassVersionError: com/flowlogix/web/services/ServicesModul&gt; e : Unsupported major.minor version 51.0&gt;         at java.lang.ClassLoader.defineClass1(Native Method)&gt;         at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)&gt;         at java.lang.ClassLoader.defineClass(ClassLoader.java:616)&gt;         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14&gt; 1)&gt;         at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)&gt;         at java.net.URLClassLoader.access$000(URLClassLoader.java:58)&gt;         at java.net.URLClassLoader$1.run(URLClassLoader.java:197)&gt;         at java.security.AccessController.doPrivileged(Native Method)&gt;         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)&gt;         at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoade&gt; r.java:392)&gt;         at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoade&gt; r.java:363)&gt;         at java.lang.Class.forName0(Native Method)&gt;         at java.lang.Class.forName(Class.java:247)&gt;         at org.apache.tapestry5.ioc.RegistryBuilder.add(RegistryBuilder.java:157&gt; )&gt;         at org.apache.tapestry5.ioc.IOCUtilities.addModulesInList(IOCUtilities.j&gt; ava:137)&gt;         at org.apache.tapestry5.ioc.IOCUtilities.addModulesInManifest(IOCUtiliti&gt; es.java:107)&gt;         at org.apache.tapestry5.ioc.IOCUtilities.addDefaultModules(IOCUtilities.&gt; java:77)&gt;         at org.apache.tapestry5.internal.TapestryAppInitializer.&lt;init&gt;(TapestryA&gt; ppInitializer.java:124)&gt;         at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:103)&gt;         at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)&gt;         at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:&gt; 50)&gt;         at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.ja&gt; va:653)&gt;         at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)&gt; &gt;   ----- Original Message ----- &gt;   From: Lenny Primak &gt;   To: Tapestry users &gt;   Sent: Monday, November 12, 2012 3:39 PM&gt;   Subject: Re: tapestry-jpa entities not associated with correct entity manager&gt; &gt; &gt;   Yes, I have multiple PUs working correctly, using Glassfish and the FlowLogix library:&gt; &gt;   Here are some references:&gt;   http://code.google.com/p/flowlogix/wiki/TLPersistenceRegistry&gt; &gt; &gt;   On Nov 12, 2012, at 6:56 AM, John wrote:&gt; &gt;   &gt; This did not work either, even though the config code is called! Has anyone got multiple persistence units working please, if so how?&gt;   &gt; &gt;   &gt; @Contribute(EntityManagerSource.class)&gt;   &gt; public static void configurePersistenceUnitInfos(&gt;   &gt;   MappedConfiguration&lt;String, PersistenceUnitConfigurer&gt; cfg,&gt;   &gt;   final Logger log) {&gt;   &gt;  PersistenceUnitConfigurer jabberConfigurer = new PersistenceUnitConfigurer() {&gt;   &gt;   public void configure(TapestryPersistenceUnitInfo unitInfo) {&gt;   &gt;    unitInfo.addManagedClass(com.audit.manager.jabber.entities.JabberUser.class);&gt;   &gt;    log.info("JabberDBUnit classes added");&gt;   &gt;   }&gt;   &gt;  };&gt;   &gt;  cfg.add("JabberDBUnit", jabberConfigurer);&gt;   &gt;  PersistenceUnitConfigurer auditConfigurer = new PersistenceUnitConfigurer() {&gt;   &gt;   public void configure(TapestryPersistenceUnitInfo unitInfo) {&gt;   &gt;    unitInfo.addManagedClass(com.audit.manager.audit.entities.ValidateUsernameBean.class);&gt;   &gt;    unitInfo.addManagedClass(com.audit.manager.audit.entities.UsersWhoCanLogIn.class);&gt;   &gt;    log.info("AuditDBUnit classes added");&gt;   &gt;   }&gt;   &gt;  };&gt;   &gt;  cfg.add("AuditDBUnit", auditConfigurer);&gt;   &gt; }&gt;   &gt; &gt;   &gt; [ERROR] TapestryModule.RequestExceptionHandler Processing of request failed with&gt;   &gt; uncaught exception: Unknown entity bean class: class com.audit.manager.audit&gt;   &gt; .entities.UsersWhoCanLogIn, please verify that this class has been marked with t&gt;   &gt; he @Entity annotation.&gt;   &gt; org.apache.tapestry5.runtime.ComponentEventException: Unknown entity bean class:&gt;   &gt; class com..audit.manager.audit.entities.UsersWhoCanLogIn, please verify that&gt;   &gt; this class has been marked with the @Entity annotation. [at classpath:com./aud&gt;   &gt; it/manager/pages/Login.tml, line 7]&gt;   &gt; &gt;   &gt; package com.audit.manager.audit.entities;&gt;   &gt; &gt;   &gt; import java.io.Serializable;&gt;   &gt; &gt;   &gt; import javax.persistence.Column;&gt;   &gt; import javax.persistence.Entity;&gt;   &gt; import javax.persistence.Id;&gt;   &gt; import javax.persistence.Table;&gt;   &gt; &gt;   &gt; @Entity&gt;   &gt; @Table(name = "v_UsersWhoCanLogIn")&gt;   &gt; public class UsersWhoCanLogIn implements Serializable {&gt;   &gt; &gt;   &gt; private static final long serialVersionUID = 803545730972339902L;&gt;   &gt; &gt;   &gt; @Id&gt;   &gt; @Column(name = "username")&gt;   &gt; private String username;&gt;   &gt;  ----- Original Message ----- &gt;   &gt;  From: Lenny Primak &gt;   &gt;  To: Tapestry users &gt;   &gt;  Cc: Tapestry users &gt;   &gt;  Sent: Sunday, November 11, 2012 4:30 PM&gt;   &gt;  Subject: Re: tapestry-jpa entities not associated with correct entity manager&gt;   &gt; &gt;   &gt; &gt;   &gt;  I would suggest either using or looking at FlowLogix tapestry library&gt;   &gt;  It has a jpa package that takes care of using multiple persistence units in one application. &gt;   &gt;  The key is to have entities with different PUs in different packages. &gt;   &gt; &gt;   &gt;  On Nov 11, 2012, at 3:49 AM, "John" &lt;john@quivinco.com&gt; wrote:&gt;   &gt; &gt;   &gt;&gt; I'm finding that entities are not being attached to the correct entity manager even though they are indicated in the persistence.xml.&gt;   &gt;&gt; &gt;   &gt;&gt; This manifests that if the user logs in first which uses AuditDBUnit then the entities in JabberDBUnit are not available. If the JabberDBUnit is used first, entities are not available from the other units.&gt;   &gt;&gt; &gt;   &gt;&gt; Is there a way to ensure the entities associate with the right persistence units?&gt;   &gt;&gt; &gt;   &gt;&gt; regards,&gt;   &gt;&gt; John&gt;   &gt;&gt; &gt;   &gt;&gt; &lt;?xml version="1.0" encoding="UTF-8"?&gt;&gt;   &gt;&gt; &lt;persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0"&gt;&gt;   &gt;&gt; &gt;   &gt;&gt;  &lt;persistence-unit name="JabberDBUnit" transaction-type="RESOURCE_LOCAL"&gt;&gt;   &gt;&gt;      &lt;provider&gt;org.eclipse.persistence.jpa.PersistenceProvider&lt;/provider&gt;&gt;   &gt;&gt;      &lt;class&gt;com..audit.manager.entities.JabberUser&lt;/class&gt;&gt;   &gt;&gt;      &lt;properties&gt;&gt;   &gt;&gt;         &lt;property name="javax.persistence.jdbc.driver"     value="org.postgresql.Driver" /&gt;&gt;   &gt;&gt;         &lt;property name="javax.persistence.jdbc.url"        value="jdbc:postgresql://212.95.225.52:5432/jsm" /&gt;&gt;   &gt;&gt;         &lt;property name="javax.persistence.jdbc.user"       value="com." /&gt;&gt;   &gt;&gt;         &lt;property name="javax.persistence.jdbc.password"   value="com." /&gt;&gt;   &gt;&gt;         &lt;property name="eclipselink.logging.level"         value="fine"/&gt;&gt;   &gt;&gt;     &lt;/properties&gt;&gt;   &gt;&gt;  &lt;/persistence-unit&gt;&gt;   &gt;&gt; &gt;   &gt;&gt;  &lt;persistence-unit name="AuditDBUnit" transaction-type="RESOURCE_LOCAL"&gt;&gt;   &gt;&gt;      &lt;provider&gt;org.eclipse.persistence.jpa.PersistenceProvider&lt;/provider&gt;&gt;   &gt;&gt;      &lt;class&gt;com..audit.manager.entities.ValidateUsernameBean&lt;/class&gt;&gt;   &gt;&gt;      &lt;class&gt;com..audit.manager.entities.UsersWhoCanLogIn&lt;/class&gt;&gt;   &gt;&gt;      &lt;properties&gt;&gt;   &gt;&gt;         &lt;property name="javax.persistence.jdbc.driver"     value="com.microsoft.sqlserver.jdbc.SQLServerDriver" /&gt;&gt;   &gt;&gt;         &lt;property name="javax.persistence.jdbc.url"        value="jdbc:sqlserver://212.95.225.51:1433;databaseName=eAudit" /&gt;&gt;   &gt;&gt;         &lt;property name="javax.persistence.jdbc.user"       value="webserver" /&gt;&gt;   &gt;&gt;         &lt;property name="javax.persistence.jdbc.password"   value="epu1s3" /&gt;&gt;   &gt;&gt;         &lt;property name="eclipselink.logging.level"         value="fine"/&gt;&gt;   &gt;&gt;     &lt;/properties&gt;&gt;   &gt;&gt;  &lt;/persistence-unit&gt;&gt;   &gt;&gt; &gt;   &gt;&gt;  &lt;persistence-unit name="IMAuditDBUnit" transaction-type="RESOURCE_LOCAL"&gt;&gt;   &gt;&gt;      &lt;provider&gt;org.eclipse.persistence.jpa.PersistenceProvider&lt;/provider&gt;&gt;   &gt;&gt;      &lt;properties&gt;&gt;   &gt;&gt;         &lt;property name="javax.persistence.jdbc.driver"     value="com.microsoft.sqlserver.jdbc.SQLServerDriver" /&gt;&gt;   &gt;&gt;         &lt;property name="javax.persistence.jdbc.url"        value="jdbc:sqlserver://212.95.225.51:1433;databaseName=eIMAudit" /&gt;&gt;   &gt;&gt;         &lt;property name="javax.persistence.jdbc.user"       value="webserver" /&gt;&gt;   &gt;&gt;         &lt;property name="javax.persistence.jdbc.password"   value="epu1s3" /&gt;&gt;   &gt;&gt;         &lt;property name="eclipselink.logging.level"         value="fine"/&gt;&gt;   &gt;&gt;     &lt;/properties&gt;&gt;   &gt;&gt;  &lt;/persistence-unit&gt;&gt;   &gt;&gt; &gt;   &gt;&gt; &lt;/persistence&gt;&gt;   &gt; &gt;   &gt;  ---------------------------------------------------------------------&gt;   &gt;  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org&gt;   &gt;  For additional commands, e-mail: users-help@tapestry.apache.org&gt; &gt; &gt;   ---------------------------------------------------------------------&gt;   To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org&gt;   For additional commands, e-mail: users-help@tapestry.apache.org

Re: tapestry-jpa entities not associated with correct entity manager

Posted by John <jo...@quivinco.com>.
Thanks for this library.

I tried the FlowLogix 1.1.7 library with my Tapestry 5.3.6 project and get this on jetty startup:

java.lang.UnsupportedClassVersionError: com/flowlogix/web/services/ServicesModul
e : Unsupported major.minor version 51.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14
1)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoade
r.java:392)
        at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoade
r.java:363)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:247)
        at org.apache.tapestry5.ioc.RegistryBuilder.add(RegistryBuilder.java:157
)
        at org.apache.tapestry5.ioc.IOCUtilities.addModulesInList(IOCUtilities.j
ava:137)
        at org.apache.tapestry5.ioc.IOCUtilities.addModulesInManifest(IOCUtiliti
es.java:107)
        at org.apache.tapestry5.ioc.IOCUtilities.addDefaultModules(IOCUtilities.
java:77)
        at org.apache.tapestry5.internal.TapestryAppInitializer.<init>(TapestryA
ppInitializer.java:124)
        at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:103)
        at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
        at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.ja
va:653)
        at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)

  ----- Original Message ----- 
  From: Lenny Primak 
  To: Tapestry users 
  Sent: Monday, November 12, 2012 3:39 PM
  Subject: Re: tapestry-jpa entities not associated with correct entity manager


  Yes, I have multiple PUs working correctly, using Glassfish and the FlowLogix library:

  Here are some references:
  http://code.google.com/p/flowlogix/wiki/TLPersistenceRegistry


  On Nov 12, 2012, at 6:56 AM, John wrote:

  > This did not work either, even though the config code is called! Has anyone got multiple persistence units working please, if so how?
  > 
  > @Contribute(EntityManagerSource.class)
  > public static void configurePersistenceUnitInfos(
  >   MappedConfiguration<String, PersistenceUnitConfigurer> cfg,
  >   final Logger log) {
  >  PersistenceUnitConfigurer jabberConfigurer = new PersistenceUnitConfigurer() {
  >   public void configure(TapestryPersistenceUnitInfo unitInfo) {
  >    unitInfo.addManagedClass(com.audit.manager.jabber.entities.JabberUser.class);
  >    log.info("JabberDBUnit classes added");
  >   }
  >  };
  >  cfg.add("JabberDBUnit", jabberConfigurer);
  >  PersistenceUnitConfigurer auditConfigurer = new PersistenceUnitConfigurer() {
  >   public void configure(TapestryPersistenceUnitInfo unitInfo) {
  >    unitInfo.addManagedClass(com.audit.manager.audit.entities.ValidateUsernameBean.class);
  >    unitInfo.addManagedClass(com.audit.manager.audit.entities.UsersWhoCanLogIn.class);
  >    log.info("AuditDBUnit classes added");
  >   }
  >  };
  >  cfg.add("AuditDBUnit", auditConfigurer);
  > }
  > 
  > [ERROR] TapestryModule.RequestExceptionHandler Processing of request failed with
  > uncaught exception: Unknown entity bean class: class com.audit.manager.audit
  > .entities.UsersWhoCanLogIn, please verify that this class has been marked with t
  > he @Entity annotation.
  > org.apache.tapestry5.runtime.ComponentEventException: Unknown entity bean class:
  > class com..audit.manager.audit.entities.UsersWhoCanLogIn, please verify that
  > this class has been marked with the @Entity annotation. [at classpath:com./aud
  > it/manager/pages/Login.tml, line 7]
  > 
  > package com.audit.manager.audit.entities;
  > 
  > import java.io.Serializable;
  > 
  > import javax.persistence.Column;
  > import javax.persistence.Entity;
  > import javax.persistence.Id;
  > import javax.persistence.Table;
  > 
  > @Entity
  > @Table(name = "v_UsersWhoCanLogIn")
  > public class UsersWhoCanLogIn implements Serializable {
  > 
  > private static final long serialVersionUID = 803545730972339902L;
  > 
  > @Id
  > @Column(name = "username")
  > private String username;
  >  ----- Original Message ----- 
  >  From: Lenny Primak 
  >  To: Tapestry users 
  >  Cc: Tapestry users 
  >  Sent: Sunday, November 11, 2012 4:30 PM
  >  Subject: Re: tapestry-jpa entities not associated with correct entity manager
  > 
  > 
  >  I would suggest either using or looking at FlowLogix tapestry library
  >  It has a jpa package that takes care of using multiple persistence units in one application. 
  >  The key is to have entities with different PUs in different packages. 
  > 
  >  On Nov 11, 2012, at 3:49 AM, "John" <jo...@quivinco.com> wrote:
  > 
  >> I'm finding that entities are not being attached to the correct entity manager even though they are indicated in the persistence.xml.
  >> 
  >> This manifests that if the user logs in first which uses AuditDBUnit then the entities in JabberDBUnit are not available. If the JabberDBUnit is used first, entities are not available from the other units.
  >> 
  >> Is there a way to ensure the entities associate with the right persistence units?
  >> 
  >> regards,
  >> John
  >> 
  >> <?xml version="1.0" encoding="UTF-8"?>
  >> <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
  >> 
  >>  <persistence-unit name="JabberDBUnit" transaction-type="RESOURCE_LOCAL">
  >>      <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
  >>      <class>com..audit.manager.entities.JabberUser</class>
  >>      <properties>
  >>         <property name="javax.persistence.jdbc.driver"     value="org.postgresql.Driver" />
  >>         <property name="javax.persistence.jdbc.url"        value="jdbc:postgresql://212.95.225.52:5432/jsm" />
  >>         <property name="javax.persistence.jdbc.user"       value="com." />
  >>         <property name="javax.persistence.jdbc.password"   value="com." />
  >>         <property name="eclipselink.logging.level"         value="fine"/>
  >>     </properties>
  >>  </persistence-unit>
  >> 
  >>  <persistence-unit name="AuditDBUnit" transaction-type="RESOURCE_LOCAL">
  >>      <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
  >>      <class>com..audit.manager.entities.ValidateUsernameBean</class>
  >>      <class>com..audit.manager.entities.UsersWhoCanLogIn</class>
  >>      <properties>
  >>         <property name="javax.persistence.jdbc.driver"     value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
  >>         <property name="javax.persistence.jdbc.url"        value="jdbc:sqlserver://212.95.225.51:1433;databaseName=eAudit" />
  >>         <property name="javax.persistence.jdbc.user"       value="webserver" />
  >>         <property name="javax.persistence.jdbc.password"   value="epu1s3" />
  >>         <property name="eclipselink.logging.level"         value="fine"/>
  >>     </properties>
  >>  </persistence-unit>
  >> 
  >>  <persistence-unit name="IMAuditDBUnit" transaction-type="RESOURCE_LOCAL">
  >>      <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
  >>      <properties>
  >>         <property name="javax.persistence.jdbc.driver"     value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
  >>         <property name="javax.persistence.jdbc.url"        value="jdbc:sqlserver://212.95.225.51:1433;databaseName=eIMAudit" />
  >>         <property name="javax.persistence.jdbc.user"       value="webserver" />
  >>         <property name="javax.persistence.jdbc.password"   value="epu1s3" />
  >>         <property name="eclipselink.logging.level"         value="fine"/>
  >>     </properties>
  >>  </persistence-unit>
  >> 
  >> </persistence>
  > 
  >  ---------------------------------------------------------------------
  >  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
  >  For additional commands, e-mail: users-help@tapestry.apache.org


  ---------------------------------------------------------------------
  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
  For additional commands, e-mail: users-help@tapestry.apache.org

Re: tapestry-jpa entities not associated with correct entity manager

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
Yes, I have multiple PUs working correctly, using Glassfish and the FlowLogix library:

Here are some references:
http://code.google.com/p/flowlogix/wiki/TLPersistenceRegistry


On Nov 12, 2012, at 6:56 AM, John wrote:

> This did not work either, even though the config code is called! Has anyone got multiple persistence units working please, if so how?
> 
> @Contribute(EntityManagerSource.class)
> public static void configurePersistenceUnitInfos(
>   MappedConfiguration<String, PersistenceUnitConfigurer> cfg,
>   final Logger log) {
>  PersistenceUnitConfigurer jabberConfigurer = new PersistenceUnitConfigurer() {
>   public void configure(TapestryPersistenceUnitInfo unitInfo) {
>    unitInfo.addManagedClass(com.audit.manager.jabber.entities.JabberUser.class);
>    log.info("JabberDBUnit classes added");
>   }
>  };
>  cfg.add("JabberDBUnit", jabberConfigurer);
>  PersistenceUnitConfigurer auditConfigurer = new PersistenceUnitConfigurer() {
>   public void configure(TapestryPersistenceUnitInfo unitInfo) {
>    unitInfo.addManagedClass(com.audit.manager.audit.entities.ValidateUsernameBean.class);
>    unitInfo.addManagedClass(com.audit.manager.audit.entities.UsersWhoCanLogIn.class);
>    log.info("AuditDBUnit classes added");
>   }
>  };
>  cfg.add("AuditDBUnit", auditConfigurer);
> }
> 
> [ERROR] TapestryModule.RequestExceptionHandler Processing of request failed with
> uncaught exception: Unknown entity bean class: class com.audit.manager.audit
> .entities.UsersWhoCanLogIn, please verify that this class has been marked with t
> he @Entity annotation.
> org.apache.tapestry5.runtime.ComponentEventException: Unknown entity bean class:
> class com..audit.manager.audit.entities.UsersWhoCanLogIn, please verify that
> this class has been marked with the @Entity annotation. [at classpath:com./aud
> it/manager/pages/Login.tml, line 7]
> 
> package com.audit.manager.audit.entities;
> 
> import java.io.Serializable;
> 
> import javax.persistence.Column;
> import javax.persistence.Entity;
> import javax.persistence.Id;
> import javax.persistence.Table;
> 
> @Entity
> @Table(name = "v_UsersWhoCanLogIn")
> public class UsersWhoCanLogIn implements Serializable {
> 
> private static final long serialVersionUID = 803545730972339902L;
> 
> @Id
> @Column(name = "username")
> private String username;
>  ----- Original Message ----- 
>  From: Lenny Primak 
>  To: Tapestry users 
>  Cc: Tapestry users 
>  Sent: Sunday, November 11, 2012 4:30 PM
>  Subject: Re: tapestry-jpa entities not associated with correct entity manager
> 
> 
>  I would suggest either using or looking at FlowLogix tapestry library
>  It has a jpa package that takes care of using multiple persistence units in one application. 
>  The key is to have entities with different PUs in different packages. 
> 
>  On Nov 11, 2012, at 3:49 AM, "John" <jo...@quivinco.com> wrote:
> 
>> I'm finding that entities are not being attached to the correct entity manager even though they are indicated in the persistence.xml.
>> 
>> This manifests that if the user logs in first which uses AuditDBUnit then the entities in JabberDBUnit are not available. If the JabberDBUnit is used first, entities are not available from the other units.
>> 
>> Is there a way to ensure the entities associate with the right persistence units?
>> 
>> regards,
>> John
>> 
>> <?xml version="1.0" encoding="UTF-8"?>
>> <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
>> 
>>  <persistence-unit name="JabberDBUnit" transaction-type="RESOURCE_LOCAL">
>>      <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
>>      <class>com..audit.manager.entities.JabberUser</class>
>>      <properties>
>>         <property name="javax.persistence.jdbc.driver"     value="org.postgresql.Driver" />
>>         <property name="javax.persistence.jdbc.url"        value="jdbc:postgresql://212.95.225.52:5432/jsm" />
>>         <property name="javax.persistence.jdbc.user"       value="com." />
>>         <property name="javax.persistence.jdbc.password"   value="com." />
>>         <property name="eclipselink.logging.level"         value="fine"/>
>>     </properties>
>>  </persistence-unit>
>> 
>>  <persistence-unit name="AuditDBUnit" transaction-type="RESOURCE_LOCAL">
>>      <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
>>      <class>com..audit.manager.entities.ValidateUsernameBean</class>
>>      <class>com..audit.manager.entities.UsersWhoCanLogIn</class>
>>      <properties>
>>         <property name="javax.persistence.jdbc.driver"     value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
>>         <property name="javax.persistence.jdbc.url"        value="jdbc:sqlserver://212.95.225.51:1433;databaseName=eAudit" />
>>         <property name="javax.persistence.jdbc.user"       value="webserver" />
>>         <property name="javax.persistence.jdbc.password"   value="epu1s3" />
>>         <property name="eclipselink.logging.level"         value="fine"/>
>>     </properties>
>>  </persistence-unit>
>> 
>>  <persistence-unit name="IMAuditDBUnit" transaction-type="RESOURCE_LOCAL">
>>      <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
>>      <properties>
>>         <property name="javax.persistence.jdbc.driver"     value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
>>         <property name="javax.persistence.jdbc.url"        value="jdbc:sqlserver://212.95.225.51:1433;databaseName=eIMAudit" />
>>         <property name="javax.persistence.jdbc.user"       value="webserver" />
>>         <property name="javax.persistence.jdbc.password"   value="epu1s3" />
>>         <property name="eclipselink.logging.level"         value="fine"/>
>>     </properties>
>>  </persistence-unit>
>> 
>> </persistence>
> 
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>  For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: tapestry-jpa @PersistenceContext annotation unitName ignored?

Posted by John <jo...@quivinco.com>.
I put some system out in JpaInternalUtils and it associates the wrong PU with the annotation I have in the service class when it instantiates.

John

  ----- Original Message ----- 
  From: Lenny Primak 
  To: Tapestry users 
  Sent: Monday, November 12, 2012 3:40 PM
  Subject: Re: tapestry-jpa @PersistenceContext annotation unitName ignored?


  No, this works fine. Your configuration is not working for some reason.
  Please see my previous e-mail.


  On Nov 12, 2012, at 7:31 AM, John wrote:

  > @Inject
  > @PersistenceContext(unitName = "JabberDBUnit")
  > private EntityManager jabberEntityManager;
  > 
  > When I output the jabberEntityManager.getEntityManagerFactory().getProperties() I find they are the configs for another PU. That is my problem!
  > 
  > It looks like tapestry-jpa is not processing the context tags correctly? The PU that gets used first is just handed to later contexts that are injected.
  > 
  > John
  > 
  > 
  > 


  ---------------------------------------------------------------------
  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
  For additional commands, e-mail: users-help@tapestry.apache.org

Re: tapestry-jpa @PersistenceContext annotation unitName ignored?

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
No, this works fine. Your configuration is not working for some reason.
Please see my previous e-mail.


On Nov 12, 2012, at 7:31 AM, John wrote:

> @Inject
> @PersistenceContext(unitName = "JabberDBUnit")
> private EntityManager jabberEntityManager;
> 
> When I output the jabberEntityManager.getEntityManagerFactory().getProperties() I find they are the configs for another PU. That is my problem!
> 
> It looks like tapestry-jpa is not processing the context tags correctly? The PU that gets used first is just handed to later contexts that are injected.
> 
> John
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


tapestry-jpa @PersistenceContext annotation unitName ignored?

Posted by John <jo...@quivinco.com>.
@Inject
 @PersistenceContext(unitName = "JabberDBUnit")
 private EntityManager jabberEntityManager;
 
When I output the jabberEntityManager.getEntityManagerFactory().getProperties() I find they are the configs for another PU. That is my problem!

It looks like tapestry-jpa is not processing the context tags correctly? The PU that gets used first is just handed to later contexts that are injected.

John




Re: tapestry-jpa entities not associated with correct entity manager

Posted by John <jo...@quivinco.com>.
This did not work either, even though the config code is called! Has anyone got multiple persistence units working please, if so how?

 @Contribute(EntityManagerSource.class)
 public static void configurePersistenceUnitInfos(
   MappedConfiguration<String, PersistenceUnitConfigurer> cfg,
   final Logger log) {
  PersistenceUnitConfigurer jabberConfigurer = new PersistenceUnitConfigurer() {
   public void configure(TapestryPersistenceUnitInfo unitInfo) {
    unitInfo.addManagedClass(com.audit.manager.jabber.entities.JabberUser.class);
    log.info("JabberDBUnit classes added");
   }
  };
  cfg.add("JabberDBUnit", jabberConfigurer);
  PersistenceUnitConfigurer auditConfigurer = new PersistenceUnitConfigurer() {
   public void configure(TapestryPersistenceUnitInfo unitInfo) {
    unitInfo.addManagedClass(com.audit.manager.audit.entities.ValidateUsernameBean.class);
    unitInfo.addManagedClass(com.audit.manager.audit.entities.UsersWhoCanLogIn.class);
    log.info("AuditDBUnit classes added");
   }
  };
  cfg.add("AuditDBUnit", auditConfigurer);
 }

[ERROR] TapestryModule.RequestExceptionHandler Processing of request failed with
 uncaught exception: Unknown entity bean class: class com.audit.manager.audit
.entities.UsersWhoCanLogIn, please verify that this class has been marked with t
he @Entity annotation.
org.apache.tapestry5.runtime.ComponentEventException: Unknown entity bean class:
 class com..audit.manager.audit.entities.UsersWhoCanLogIn, please verify that
this class has been marked with the @Entity annotation. [at classpath:com./aud
it/manager/pages/Login.tml, line 7]

package com.audit.manager.audit.entities;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "v_UsersWhoCanLogIn")
public class UsersWhoCanLogIn implements Serializable {

 private static final long serialVersionUID = 803545730972339902L;

 @Id
 @Column(name = "username")
 private String username;
  ----- Original Message ----- 
  From: Lenny Primak 
  To: Tapestry users 
  Cc: Tapestry users 
  Sent: Sunday, November 11, 2012 4:30 PM
  Subject: Re: tapestry-jpa entities not associated with correct entity manager


  I would suggest either using or looking at FlowLogix tapestry library
  It has a jpa package that takes care of using multiple persistence units in one application. 
  The key is to have entities with different PUs in different packages. 

  On Nov 11, 2012, at 3:49 AM, "John" <jo...@quivinco.com> wrote:

  > I'm finding that entities are not being attached to the correct entity manager even though they are indicated in the persistence.xml.
  > 
  > This manifests that if the user logs in first which uses AuditDBUnit then the entities in JabberDBUnit are not available. If the JabberDBUnit is used first, entities are not available from the other units.
  > 
  > Is there a way to ensure the entities associate with the right persistence units?
  > 
  > regards,
  > John
  > 
  > <?xml version="1.0" encoding="UTF-8"?>
  > <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
  > 
  >   <persistence-unit name="JabberDBUnit" transaction-type="RESOURCE_LOCAL">
  >       <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
  >       <class>com..audit.manager.entities.JabberUser</class>
  >       <properties>
  >          <property name="javax.persistence.jdbc.driver"     value="org.postgresql.Driver" />
  >          <property name="javax.persistence.jdbc.url"        value="jdbc:postgresql://212.95.225.52:5432/jsm" />
  >          <property name="javax.persistence.jdbc.user"       value="com." />
  >          <property name="javax.persistence.jdbc.password"   value="com." />
  >          <property name="eclipselink.logging.level"         value="fine"/>
  >      </properties>
  >   </persistence-unit>
  > 
  >   <persistence-unit name="AuditDBUnit" transaction-type="RESOURCE_LOCAL">
  >       <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
  >       <class>com..audit.manager.entities.ValidateUsernameBean</class>
  >       <class>com..audit.manager.entities.UsersWhoCanLogIn</class>
  >       <properties>
  >          <property name="javax.persistence.jdbc.driver"     value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
  >          <property name="javax.persistence.jdbc.url"        value="jdbc:sqlserver://212.95.225.51:1433;databaseName=eAudit" />
  >          <property name="javax.persistence.jdbc.user"       value="webserver" />
  >          <property name="javax.persistence.jdbc.password"   value="epu1s3" />
  >          <property name="eclipselink.logging.level"         value="fine"/>
  >      </properties>
  >   </persistence-unit>
  > 
  >   <persistence-unit name="IMAuditDBUnit" transaction-type="RESOURCE_LOCAL">
  >       <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
  >       <properties>
  >          <property name="javax.persistence.jdbc.driver"     value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
  >          <property name="javax.persistence.jdbc.url"        value="jdbc:sqlserver://212.95.225.51:1433;databaseName=eIMAudit" />
  >          <property name="javax.persistence.jdbc.user"       value="webserver" />
  >          <property name="javax.persistence.jdbc.password"   value="epu1s3" />
  >          <property name="eclipselink.logging.level"         value="fine"/>
  >      </properties>
  >   </persistence-unit>
  > 
  > </persistence>

  ---------------------------------------------------------------------
  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
  For additional commands, e-mail: users-help@tapestry.apache.org

Re: tapestry-jpa entities not associated with correct entity manager

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
I would suggest either using or looking at FlowLogix tapestry library
It has a jpa package that takes care of using multiple persistence units in one application. 
The key is to have entities with different PUs in different packages. 

On Nov 11, 2012, at 3:49 AM, "John" <jo...@quivinco.com> wrote:

> I'm finding that entities are not being attached to the correct entity manager even though they are indicated in the persistence.xml.
> 
> This manifests that if the user logs in first which uses AuditDBUnit then the entities in JabberDBUnit are not available. If the JabberDBUnit is used first, entities are not available from the other units.
> 
> Is there a way to ensure the entities associate with the right persistence units?
> 
> regards,
> John
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
> 
>   <persistence-unit name="JabberDBUnit" transaction-type="RESOURCE_LOCAL">
>       <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
>       <class>com..audit.manager.entities.JabberUser</class>
>       <properties>
>          <property name="javax.persistence.jdbc.driver"     value="org.postgresql.Driver" />
>          <property name="javax.persistence.jdbc.url"        value="jdbc:postgresql://212.95.225.52:5432/jsm" />
>          <property name="javax.persistence.jdbc.user"       value="com." />
>          <property name="javax.persistence.jdbc.password"   value="com." />
>          <property name="eclipselink.logging.level"         value="fine"/>
>      </properties>
>   </persistence-unit>
> 
>   <persistence-unit name="AuditDBUnit" transaction-type="RESOURCE_LOCAL">
>       <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
>       <class>com..audit.manager.entities.ValidateUsernameBean</class>
>       <class>com..audit.manager.entities.UsersWhoCanLogIn</class>
>       <properties>
>          <property name="javax.persistence.jdbc.driver"     value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
>          <property name="javax.persistence.jdbc.url"        value="jdbc:sqlserver://212.95.225.51:1433;databaseName=eAudit" />
>          <property name="javax.persistence.jdbc.user"       value="webserver" />
>          <property name="javax.persistence.jdbc.password"   value="epu1s3" />
>          <property name="eclipselink.logging.level"         value="fine"/>
>      </properties>
>   </persistence-unit>
> 
>   <persistence-unit name="IMAuditDBUnit" transaction-type="RESOURCE_LOCAL">
>       <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
>       <properties>
>          <property name="javax.persistence.jdbc.driver"     value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
>          <property name="javax.persistence.jdbc.url"        value="jdbc:sqlserver://212.95.225.51:1433;databaseName=eIMAudit" />
>          <property name="javax.persistence.jdbc.user"       value="webserver" />
>          <property name="javax.persistence.jdbc.password"   value="epu1s3" />
>          <property name="eclipselink.logging.level"         value="fine"/>
>      </properties>
>   </persistence-unit>
> 
> </persistence>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


tapestry-jpa entities not associated with correct entity manager

Posted by John <jo...@quivinco.com>.
I'm finding that entities are not being attached to the correct entity manager even though they are indicated in the persistence.xml.

This manifests that if the user logs in first which uses AuditDBUnit then the entities in JabberDBUnit are not available. If the JabberDBUnit is used first, entities are not available from the other units.

Is there a way to ensure the entities associate with the right persistence units?

regards,
John

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">

   <persistence-unit name="JabberDBUnit" transaction-type="RESOURCE_LOCAL">
       <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
       <class>com..audit.manager.entities.JabberUser</class>
       <properties>
          <property name="javax.persistence.jdbc.driver"     value="org.postgresql.Driver" />
          <property name="javax.persistence.jdbc.url"        value="jdbc:postgresql://212.95.225.52:5432/jsm" />
          <property name="javax.persistence.jdbc.user"       value="com." />
          <property name="javax.persistence.jdbc.password"   value="com." />
          <property name="eclipselink.logging.level"         value="fine"/>
      </properties>
   </persistence-unit>

   <persistence-unit name="AuditDBUnit" transaction-type="RESOURCE_LOCAL">
       <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
       <class>com..audit.manager.entities.ValidateUsernameBean</class>
       <class>com..audit.manager.entities.UsersWhoCanLogIn</class>
       <properties>
          <property name="javax.persistence.jdbc.driver"     value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
          <property name="javax.persistence.jdbc.url"        value="jdbc:sqlserver://212.95.225.51:1433;databaseName=eAudit" />
          <property name="javax.persistence.jdbc.user"       value="webserver" />
          <property name="javax.persistence.jdbc.password"   value="epu1s3" />
          <property name="eclipselink.logging.level"         value="fine"/>
      </properties>
   </persistence-unit>

   <persistence-unit name="IMAuditDBUnit" transaction-type="RESOURCE_LOCAL">
       <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
       <properties>
          <property name="javax.persistence.jdbc.driver"     value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
          <property name="javax.persistence.jdbc.url"        value="jdbc:sqlserver://212.95.225.51:1433;databaseName=eIMAudit" />
          <property name="javax.persistence.jdbc.user"       value="webserver" />
          <property name="javax.persistence.jdbc.password"   value="epu1s3" />
          <property name="eclipselink.logging.level"         value="fine"/>
      </properties>
   </persistence-unit>

</persistence>

Re: Negate a triggerfragment?

Posted by Muhammad Gelbana <m....@gmail.com>.
The "FormFragment" component has an attribute for that, "visible"

Check the docs please before mailing the list :)
http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/FormFragment.html


On Sat, Nov 10, 2012 at 2:05 PM, membersound <me...@web.de> wrote:

> Well the invert works in general. BUT though the inverted fragment /is
> /visible on first rendering with uncheck box!
> If I then check>uncheck the box one time, it disappears for unchecked as
> expected. But this it not the case for the initial render!
>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Negate-a-triggerfragment-tp5717884p5717901.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Negate a triggerfragment?

Posted by membersound <me...@web.de>.
Well the invert works in general. BUT though the inverted fragment /is
/visible on first rendering with uncheck box!
If I then check>uncheck the box one time, it disappears for unchecked as
expected. But this it not the case for the initial render!



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Negate-a-triggerfragment-tp5717884p5717901.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Negate a triggerfragment?

Posted by Muhammad Gelbana <m....@gmail.com>.
It's in the docs:
http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/mixins/TriggerFragment.html

The "invert" attribute


On Fri, Nov 9, 2012 at 7:03 PM, membersound <me...@web.de> wrote:

> Hi,
>
> how can I negate a triggerfragment? So that it only shows up if checkbox is
> /un/checked?
> Especially: why does the following not work?
> <t:checkbox t:id="checkbox" value="object.bool" t:mixins="triggerfragment"
> fragment="frag"/>
> <t:formfragment t:id="frag" visible="!object.bool">
>
> It initially does not show the fragment (as default value of object.bool =
> true). But if I uncheck the checkbox, it does not trigger the fragment. BUT
> if I then check the checkbox again (which should intentionally hide the
> fragment) it is shown instead!
>
> class Page {
>    @Property
>    @Persist
>    Object object;
> }
>
> class Object {
>    boolean bool = true;
> }
>
>
> What's wrong here?
>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Negate-a-triggerfragment-tp5717884.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>