Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] The state field path 'a.id' cannot be resolved to a valid type

Hi Guy,

i have tried the latest nightly build and the bug was gone
thanks for the fix :)

cheers,
Justin

On 12-11-08 09:46 AM, Guy Pelletier wrote:
Hi Justin,

A fix for this problem has now been submitted:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=393867

You can pick up the fix (starting tomorrow) in a nightly build for 2.5 here:

http://www.eclipse.org/eclipselink/downloads/nightly.php

Cheers,
Guy

On 06/11/2012 9:11 AM, Guy Pelletier wrote:
Hi Justin,

That would be a bug, can you please enter one?

Unfortunately I can't think of a good work around right now other than using native queries (where you will have to be tenant aware yourself and query the correct schema/tenant).

Cheers,
Guy

On 05/11/2012 10:49 PM, Developer Account wrote:
Hi Guy,

- i dont get the error when i comment out multitenancy on UserCount
// @Multitenant(MultitenantType.TABLE_PER_TENANT)
// @TenantTableDiscriminator(type= TenantTableDiscriminatorType.SCHEMA, contextProperty= "eclipselink.tenant-id")

- here is the content of the UserCount entity
btw id column uses a sequence like
ALTER TABLE users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);

but i get the same error when i try this as well
SELECT a FROM UserCount a ORDER BY a.count DESC

@Entity
@Cache(type=CacheType.WEAK,size=1,expiry=1000)
@Table(name = "users")
@Multitenant(MultitenantType.TABLE_PER_TENANT)
@TenantTableDiscriminator(type= TenantTableDiscriminatorType.SCHEMA, contextProperty= "eclipselink.tenant-id")
@NamedQueries({
    @NamedQuery(name = "UserCount.findAll",
        query = "SELECT a FROM UserCount a ORDER BY a.id DESC")       
})
public class UserCount implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id", nullable = false)   
    private Integer id;
   
    @Column(name = "count")
    private Integer count;

    public UserCount() {
    }

    public UserCount(Integer id) {
        this.id = id;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }   

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }   

}

cheers,
Justin

On 12-11-05 05:18 AM, Guy Pelletier wrote:
Hi,

Couple questions:

 1- Can you post the content of the UserCount entity?
 2- Does the error still occur if you comment out the multitenancy on UserCount?

Cheers,
Guy

On 05/11/2012 3:29 AM, Developer Account wrote:
hi guys,

i am using eclipselink 2.4.1 and sun-glassfish 3.1.2 on my enterprise application
i updated sun-glassfish modules with org.eclipse.persistence.* jars

i am trying to implement TABLE_PER_TENANT multitenant type and i have multi-tenant-pu defined in persistence.xml like

<persistence-unit name="multi-tenant-pu" transaction-type="RESOURCE_LOCAL">
    <properties>
      <property name="eclipselink.logging.level" value="ALL"/>
      <property name="eclipselink.weaving" value="static"/>
      <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"></property>
      <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/test"></property>
      <property name="javax.persistence.jdbc.user" value="postgres"></property>
      <property name="javax.persistence.jdbc.password" value=" "></property>
      <property name="eclipselink.tenant-id" value="public"/>
    </properties>
     <class>com.company.project.persistence.model.test.UserCount</class>

</persistence-unit>

and model class like

@Entity
@Cache(type=CacheType.WEAK,size=1,expiry=1000)
@Table(name = "users")
@Multitenant(MultitenantType.TABLE_PER_TENANT)
@TenantTableDiscriminator(type= TenantTableDiscriminatorType.SCHEMA, contextProperty= "eclipselink.tenant-id")
@NamedQueries({
    @NamedQuery(name = "UserCount.findAll",
        query = "SELECT a FROM UserCount a ORDER BY a.id DESC")       
})
public class
UserCount implements Serializable {
....

and i create the query in my @Stateless class like

@Stateless
@Local
@TransactionAttribute(value = TransactionAttributeType.REQUIRED)
public class UserCountController {
   
    @PersistenceUnit(unitName="multi-tenant-pu")
    protected EntityManagerFactory emf;
   
    public String getUserCount() {
        EntityManager em = null;
        EntityTransaction tx = null;
        int userCount = 0;                   
       
        Query query;
        try {
            HashMap properties = new HashMap();
            properties.put(EntityManagerProperties.MULTITENANT_PROPERTY_DEFAULT, "tenant1");
           
            em = emf.createEntityManager(properties);
            tx = em.getTransaction();           
            tx.begin();
           
            query = em.createNamedQuery("UserCount.findAll");
            query.setMaxResults(1);
           
            int result = ((UserCount)(query.getSingleResult())).getCount();
           
            userCount = result;
        } catch (Exception ex) {
            tx.rollback();
            System.out.println(ex.toString());
        } finally {
            if (em != null && em.isOpen()) {
                em.close();
            }
        }
       
        return String.valueOf(userCount);
    }
}



When sun-glassfish is deploying the persistence-unit it throws this weird error:

Exception [EclipseLink-28019] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Deployment of PersistenceUnit [syslog] failed. Close all factories for this PersistenceUnit.
Internal Exception: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Problem compiling [SELECT a FROM UserCount a ORDER BY a.id DESC].
[37, 41] The state field path 'a.id' cannot be resolved to a valid type.
    at org.eclipse.persistence.exceptions.EntityManagerSetupException.deployFailed(EntityManagerSetupException.java:229)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.createDeployFailedPersistenceException(EntityManagerSetupImpl.java:616)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:596)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:186)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:278)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:304)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:282)
    at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:211)
    at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:120)
    at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:224)
    at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:495)
    at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:233)
    at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:871)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:410)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:461)
    at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:212)
    at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
    at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:679)


any help would be much appreciated

thanks in advance.

Justin


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

--

Oracle
Guy Pelletier

ORACLE Canada, 45 O'Connor Street Suite 400 Ottawa, Ontario Canada K1P 1A4

Green Oracle Oracle is committed to developing practices and products that help protect the environment



_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users



_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

--

Oracle
Guy Pelletier

ORACLE Canada, 45 O'Connor Street Suite 400 Ottawa, Ontario Canada K1P 1A4

Green
                Oracle Oracle is committed to developing practices and products that help protect the environment



_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

--

Oracle
Guy Pelletier

ORACLE Canada, 45 O'Connor Street Suite 400 Ottawa, Ontario Canada K1P 1A4

Green
              Oracle Oracle is committed to developing practices and products that help protect the environment



_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top