Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » persist() kicking up error about unknown entity type(persist() kicking up error about unknown entity type)
persist() kicking up error about unknown entity type [message #645378] Thu, 16 December 2010 15:02 Go to next message
Steven Dahlin is currently offline Steven Dahlin
Messages: 18
Registered: May 2010
Junior Member
When attempting to persist an instance of an entity which has been identified in the persistence.xml. I am getting an error "java.lang.IllegalArgumentException: Object: com.hwcs.producta.jpa.StagingMtrdev@5d51fe8a is not a known entity type". The class StagingMtrdev is in the persistence.xml and other entities have been persisted before this would be. What is curious is that this problem earlier had not consistently arisen so I am perplexed as to the cause.

Here is the full stacktrace:
Object: com.hwcs.producta.jpa.StagingMtrdev@5d51fe8a is not a known entity type.
java.lang.IllegalArgumentException: Object: com.hwcs.producta.jpa.StagingMtrdev@5d51fe8a is not a known entity type.
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.reg isterNewObjectForPersist(UnitOfWorkImpl.java:4199)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.persi st(EntityManagerImpl.java:384)
at com.hwcs.producta.xml.sax.VmonSaxEventHandler.BuildMtrDev(Vm onSaxEventHandler.java:2112)
at com.hwcs.producta.xml.sax.VmonSaxEventHandler.EndFrameElemen t(VmonSaxEventHandler.java:317)
at com.hwcs.producta.xml.sax.VmonSaxEventHandler.endElement(Vmo nSaxEventHandler.java:156)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unkno wn Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEn dElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Fragme ntContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDo cument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:198)
at com.hwcs.producta.action.ProcessVelocitySaxImpl.Execute(Proc essVelocitySaxImpl.java:161)
at com.hwcs.producta.main.ProcessVMData.Execute(ProcessVMData.j ava:204)
at com.hwcs.producta.main.ProcessVMData.main(ProcessVMData.java :86)

And here is a piece of the persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.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_2_0.xsd">
<persistence-unit name="JpaPU" transaction-type="RESOURCE_LOCAL">
<class>com.hwcs.producta.jpa.StagingMtrsy</class>
... properties for the driver, etc.
</persistence-unit>
</persistence>

I have seen various instances of this arise but could find anything that explained the problem, especially its intermittent nature.

Thanks
Re: persist() kicking up error about unknown entity type [message #647109 is a reply to message #645378] Tue, 04 January 2011 11:15 Go to previous message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Note the error is on StagingMtrdev and your persistence.xml has StagingMtrsy.

If it is indeed a registered class, then my guess would be a class-loader issue. What environment are you using (JEE, Spring, OSGi?)? Do you redeploy the application, or use multiple class loaders?


James : Wiki : Book : Blog : Twitter
Previous Topic:FK value setting in a ManyToOne relationship
Next Topic:@ElementCollection with @MapKeyJoinColumn and @Embeddable as value not persisting in correct order
Goto Forum:
  


Current Time: Tue Jul 29 13:02:08 EDT 2014

Powered by FUDForum. Page generated in 0.04900 seconds