[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] Testing using Eclipselink SE managed EntityManager
|
Hi Zachary,
In an effort to make things convenient, we have added some functionality that
attempts to automatically detect your entity classes by allowing you to tell the
persistence unit not to exclude unlisted classes. Our current implementation
takes into account the ones we expected would be the most common ones. (i.e. we
have handling for jar files, for an exploded directory format and for certain
types of URLs) It appears as though your maven-based deployment scheme is not
currently supported.
In general, we would like to support this functionality in as many ways as
possible. I suggest entering an enhancement request with a detailed description
of how your maven deployment is set-up. i.e. how to recreate the problem you
are seeing.
If you are interested in seeing how this functionality is implemented or in
debugging, the majority of the code can be found in our
org.eclipse.persistence.internal.jpa.deployment package. You should start by
looking at the classes that have "Archive" in their classname, starting with
ArchiveFactoryImpl.
BTW: If you take a look at the JPA Spec, in Java SE, in order to be portable,
applications are required to list all the classes in the persistence.xml. This
is considered to be a best practice for Java SE applications.
-Tom
Zachary Smith wrote:
I am trying to write some unit tests for session beans using JUnit,
DbUnit, EclipseLink and then running with Maven. When maven runs the
test I get errors similar to the following:
java.lang.IllegalArgumentException: Unknown entity bean class: class
eiss.entities.fund.Fund, please verify that this class has been marked
with the @Entity annotation.
at
org.eclipse.persistence.internal.jpa.EntityManagerImpl.find(EntityManagerImpl.java:309)
at
eiss.business.nav.NavPostBeanTest.testEQMC_DD_FundPost(NavPostBeanTest.java:101)
These same tests run just fine in our Ant system as well as from Eclipse
but seem to have problems from Maven. If I list each Entity class used
by the tests in the persistence.xml then everything runs just fine and
all tests pass. In our current (ant based) build simply having
<exclude-unlisted-classes>false</exclude-unlisted-classes> in our
persistence.xml seems to allow us to NOT have to specify each <class>.
Any pointers on what I can try to resolve this? I'd really like to
avoid listing each class in the test persistence.xml.
Thanks!
-zach
(a copy of our persistence.xml for SE testing)
<?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="EISS_test" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<!-- class>eiss.entities.fund.Fund</class>
<class>eiss.entities.fund.Client</class>
<class>eiss.entities.fund.Relationship</class>
<class>eiss.entities.fund.FundClass</class>
<class>eiss.entities.fund.FundGroup</class>
<class>eiss.entities.fund.Series</class>
<class>eiss.entities.fee.FeeProfile</class>
<class>eiss.entities.fee.FeeProfile</class>
<class>eiss.entities.nav.MeNavFundInfo</class>
<class>eiss.entities.nav.MeNav</class>
<class>eiss.entities.nav.Distribution</class>
<class>eiss.entities.nav.FundPnl</class>
<class>eiss.entities.nav.MeNavAdjustment</class>
<class>eiss.entities.nav.NavLock</class>
<class>eiss.entities.sidepocket.SidePocket</class>
<class>eiss.entities.nav.MeNavAdjustmentSeries</class>
<class>eiss.entities.rollup.RollSeries</class>
<class>eiss.entities.trans.Transaction</class-->
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.jdbc.driver"
value="com.sybase.jdbc3.jdbc.SybDriver" />
<property name="eclipselink.jdbc.url"
value="jdbc:sybase:Tds:localhost:2638" />
<property name="eclipselink.jdbc.user" value="dba" />
<property name="eclipselink.jdbc.password" value="lemons" />
<property name="eclipselink.target-database"
value="SQLAnywhere" />
<property name="eclipselink.jdbc.read-connections.max"
value="10" />
<property name="eclipselink.jdbc.read-connections.min"
value="2" />
<property name="eclipselink.jdbc.write-connections.min"
value="2" />
<property name="eclipselink.jdbc.write-connections.max"
value="10" />
<property name="eclipselink.logging.level" value="SEVERE" />
</properties>
</persistence-unit>
</persistence>
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users