dev@glassfish.java.net

Re: "Unknown abstract schema type" while accessing PU

From: Sahoo <Sahoo_at_Sun.COM>
Date: Tue, 28 Aug 2007 09:51:48 +0530

Arun,

GlassFish JPA provider discovers entity classes automatically for Java
EE use of JPA, but for Java SE style use, user has to explicitly request
that feature by adding
<exclude-unlisted-classes>false</exclude-unlisted-classes>
in persistence.xml.

Thanks,
Sahoo

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
>