Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problems using a backing map cache + @ElementCollection

660069Nov 24 2010 — edited Nov 25 2010
Hi,

I'm slowly getting to grips with Coherence. However in my on-going quest to interface coherence into our existing system I've hit (another) bump.

I've managed to reflect our C++ objects in Eclipse Link. However the objects have collections. I found what seems to be the ideal solution ElementCollection!

However after a day of typing !64 combinations of this attribute I haven't yet managed to make it work! I was wondering if someone could help me out.

I want to refer to a set of longs defined by another table.

The simple table looks like this.
@Entity
@Table(name="FCS_ISSR_OBG")
public class fcs_issr_obg implements Serializable, PortableObject {

	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="PTY_NO")
	private long pty_no;

	@Column(name="REF_OBG")
	private long ref_obg;

	public fcs_issr_obg() {
	}

	public long getPtyNo() {
		return this.pty_no;
	}

	public void setPtyNo(long pty_no) {
		this.pty_no = pty_no;
	}

	public long getRefObg() {
		return this.ref_obg;
	}

	public void setRefObg(long ref_obg) {
		this.ref_obg = ref_obg;
	}

	@Override
	public void readExternal(PofReader in) throws IOException 
	{
		pty_no=in.readLong(0);
		ref_obg=in.readLong(1);
	}


	@Override
	public void writeExternal(PofWriter out) throws IOException
	{
		out.writeLong(0,pty_no);
		out.writeLong(1,ref_obg);
	}
}
In the class where I want the collection to exist I have the following
	@ElementCollection(targetClass = java.lang.Long.class)
	@CollectionTable(
			name = "FCS_ISSR_OBG",
			joinColumns=@JoinColumn(name="FCS_ISSR_OBG.PTY_NO")
			)
	@Column(name ="REF_OBG")
	private long def_obg_list[];
The code compiles, however when I run the unit test I get the following.
Local Exception Stack: 
Exception [EclipseLink-30005] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: sun.misc.Launcher$AppClassLoader@11b86e7
Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [FocusCache] failed.
Internal Exception: Exception [EclipseLink-7311] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.ValidationException
Exception Description: An invalid target class is being used with the element collection attribute [def_obg_list] on the class [class com.xxx.focus.model.fcs_issr].  Only basic types and embeddable classes are allowed.
	at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:126)
	at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:136)
	at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:65)
	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
	at com.xxx.focus.model.TestSecurity.setUp(TestSecurity.java:29)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [FocusCache] failed.
Internal Exception: Exception [EclipseLink-7311] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.ValidationException
Exception Description: An invalid target class is being used with the element collection attribute [def_obg_list] on the class [class com.xxx.focus.model.fcs_issr].  Only basic types and embeddable classes are allowed.
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1005)
	at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:88)
	at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:127)
	... 26 more
Caused by: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [FocusCache] failed.
Internal Exception: Exception [EclipseLink-7311] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.ValidationException
Exception Description: An invalid target class is being used with the element collection attribute [def_obg_list] on the class [class com.xxx.focus.model.fcs_issr].  Only basic types and embeddable classes are allowed.
	at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:210)
	... 29 more
Caused by: Exception [EclipseLink-7311] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.ValidationException
Exception Description: An invalid target class is being used with the element collection attribute [def_obg_list] on the class [class com.xxx.focus.model.fcs_issr].  Only basic types and embeddable classes are allowed.
	at org.eclipse.persistence.exceptions.ValidationException.invalidTargetClass(ValidationException.java:2510)
	at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.ElementCollectionAccessor.process(ElementCollectionAccessor.java:721)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processDirectCollectionAccessors(MetadataProject.java:1201)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage3(MetadataProject.java:1554)
	at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processORMMetadata(MetadataProcessor.java:475)
	at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:441)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:959)
	... 28 more
I have coped the example cited here (http://en.wikibooks.org/wiki/Java_Persistence/ElementCollection) (Basic Collections).

However I guess I've done something wrong.

Any help much appreciated.

Thanks
Rich
This post has been answered by Gordon Yorke-Oracle on Nov 24 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 23 2010
Added on Nov 24 2010
2 comments
295 views