dev@glassfish.java.net

Re: "Unknown abstract schema type" while accessing PU

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Mon, 27 Aug 2007 19:40:56 -0700

A webapp in GlassFish can use EMF injection/lookup, which will make it a "real"
Java EE app, will allow to use UserTransaction or will make sure that your
<non-jta-data-source>jdbc/sample is actually a non-tx datasource (otherwise
you'd be better off using jdbc/sample__nontx name to get non-transactional
connections that the JPA provider can safely call commit on).

Regards,
-marina

Arun Gupta wrote:
> Even though this application is deployed on GlassFish as a webapp, what
> is required to make this a Java EE app ?
>
> -Arun
>
> Marina Vatkina wrote:
>
>> I think that when you use Persistence.createEntityManagerFactory(),
>> you must list your entities in the persistence.xml as it's considered
>> to be a Java SE environment.
>>
>> thanks,
>> -marina
>>
>> Arun Gupta wrote:
>>
>>> In NB 5.5.1, I created a Persistence Unit for a pre-configured
>>> jdbc/sample database. Then I created an Entity Class from this PU to
>>> generate a dynamic page. The page content looks like:
>>>
>>> -- cut here --
>>> EntityManagerFactory emf =
>>> Persistence.createEntityManagerFactory("jmaki-jpa4PU");
>>> EntityManager em = emf.createEntityManager();
>>>
>>> List<Customer> list = em.createQuery("select c from Customer
>>> c").getResultList();
>>> -- cut here --
>>>
>>> The persistence.xml looks like:
>>>
>>> -- cut here --
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <persistence version="1.0"
>>> xmlns="http://java.sun.com/xml/ns/persistence"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
>>> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
>>> <persistence-unit name="jmaki-jpa4PU"
>>> transaction-type="RESOURCE_LOCAL">
>>> <non-jta-data-source>jdbc/sample</non-jta-data-source>
>>> <properties/>
>>> </persistence-unit>
>>> </persistence>
>>> -- cut here --
>>>
>>> And here is the error that I'm getting while accessing this page:
>>>
>>> -- cut here --
>>> Exception [TOPLINK-8034] (Oracle TopLink Essentials - 2.0 (Build
>>> b58-rc1 (08/04/2007))):
>>> oracle.toplink.essentials.exceptions.EJBQLException
>>> Exception Description: Error compiling the query [select c from
>>> Customer c]. Unknown abstract schema type [Customer].
>>> -- cut here --
>>>
>>> Most of the stuff is generated for me (database, persistence.xml, PU,
>>> entity class) and I'm still seeing this error. I verified the table
>>> contains appropriate data.
>>>
>>> What can cause this ?
>>>
>>> Thanks,
>>> -Arun
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>