Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Testing using Eclipselink SE managed EntityManager

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>


Back to the top