Yes, Thanks for responding. The ErrorItemVO is written to the DB with no
problems. InErrorVO gives me the problem. 


Here is the mapped super class's annotation:
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(name = "ErrorItem", propOrder = {
    "error",
    "header",
    "captureDate",
    "isn",
    "micr",
    "region",
    "currency",
    "businessDate",
    "owning",
    "offset"
})
public class ErrorItem {

    @XmlElement(name = "Error", required = true)
    protected ErrorFile error;
    @XmlElement(name = "Header", type = HeaderVO.class)
    protected HeaderVO header;
    @XmlElement(name = "CaptureDate", type = String.class)
    @XmlJavaTypeAdapter(Adapter2 .class)
    @XmlSchemaType(name = "date")
    protected Date captureDate;
    @XmlElement(name = "ISN")
    protected String isn;
    @XmlElement(name = "MICR")
    protected MICR micr;
    @XmlElement(name = "Region")
    protected String region;
    @XmlElement(name = "Currency")
    protected Currency currency;
    @XmlElement(name = "BusinessDate", type = String.class)
    @XmlJavaTypeAdapter(Adapter2 .class)
    @XmlSchemaType(name = "date")
    protected Date businessDate;
    @XmlElement(name = "Owning")
    protected Owning owning;
    @XmlElement(name = "Offset")
    protected Offset offset;

Here are the two entities

public class ErrorItemVO extends ErrorItem implements Serializable {
        
        private static final long serialVersionUID = 1L;
        private long id;

        public long getId() {
                return id;
        }

        public void setId(long id) {
                this.id = id;
        }
        
}

and

public class InErrorVO extends ErrorItem implements Serializable {
        
        private static final long serialVersionUID = 1L;
        
        private long id;

        public long getId() {
                return id;
        }

        public void setId(long id) {
                this.id = id;
        }
        
}

and here is the xml mappings

    <mapped-superclass class="com.symcor.sis.sisinternal.ErrorItem" >
        <attributes>
                        <basic name="captureDate">
                        <column name="PROCESSING_DATE" />
                        <temporal>DATE</temporal>
                </basic>
                        <basic name="isn">
                        <column name="ISN" length="12" />
                </basic>
                        <basic name="region">
                        <column name="REGION_CODE" />
                </basic>
                        <basic name="businessDate">
                        <column name="BUSINESS_DATE" />
                        <temporal>DATE</temporal>
                </basic>
                        <basic name="currency" fetch="EAGER">
                                <column name="CURRENCY_TYPE" length="3" />
                                <enumerated>STRING</enumerated>
                        </basic>
                <many-to-one name="header">
                                <join-column name="HEADER_RECORD_ID" />
                        </many-to-one>
                <embedded name="micr"/>
                <embedded name="error"/>
                <embedded name="owning"/>
                <embedded name="offset"/>
        </attributes>
    </mapped-superclass>

    <entity class="com.symcor.sis.eps.vo.HeaderVO">
        <table name="HEADER_RECORD">
                <unique-constraint>
                <column-name>SOURCE_APPLICATION_CODE</column-name>
                <column-name>FCN</column-name>
                <column-name>CLIENT_CODE</column-name>
                </unique-constraint>
        </table>
        <attributes>
                <id name="id">
                        <column name="HEADER_RECORD_ID" nullable="false" />
                        <generated-value strategy="SEQUENCE" 
generator="HeaderRecordSeq"/>                       
                                <sequence-generator name="HeaderRecordSeq"
sequence-name="SEQ_HEADER_RECORD_ID" initial-value="0" />  
                        </id>
        </attributes>
    </entity>            
    <entity class="com.symcor.sis.eps.vo.ErrorItemVO">
        <table name="ERROR_RECORD" />
                <attributes>
                        <id name="id">
                                <column name="ERROR_RECORD_ID" nullable="false" 
/>
                        <generated-value strategy="SEQUENCE" 
generator="ErrorRecordSeq"/>
                        <sequence-generator name="ErrorRecordSeq"
sequence-name="SEQ_ERROR_RECORD_ID" initial-value="0"/> 
                        </id>
                </attributes>
    </entity>
    <entity class="com.symcor.sis.eps.vo.InErrorVO">
        <table name="IN_ERROR_RECORD" />
                <attributes>
                        <id name="id">
                                <column name="IN_ERROR_RECORD_ID" 
nullable="false" />
                        <generated-value strategy="SEQUENCE" 
generator="InErrorRecordSeq"/>
                        <sequence-generator name="InErrorRecordSeq"
sequence-name="SEQ_IN_ERROR_RECORD_ID" initial-value="0"/>  
                        </id>
                </attributes>
    </entity>

The full error says:
Caused by: org.springframework.dao.InvalidDataAccessApiUsageException:
Encountered unmanaged object "[EMAIL PROTECTED]" in
persistent field "com.symcor.sis.sisinternal.ErrorItem.header" of managed
object "[EMAIL PROTECTED]" during flush.  However,
this fie
ld does not allow cascade persist.  You cannot flush unmanaged objects.;
nested exception is <4|false|0.9.6-incubating>
org.apache.openjpa.persistence
.InvalidStateException: Encountered unmanaged object
"[EMAIL PROTECTED]" in persistent field
"com.symcor.sis.sisinternal.ErrorItem.header" of managed object
"[EMAIL PROTECTED]" during flush.  However, this
field does not allow cascade persist.  You cannot
flush unmanaged objects.




farsad wrote:
> 
> I have never encountered this problem under the current circumstances. My
> question is if you can have two different <entity>s (or tables in the
> database) inherit from the same MappedSuperClass?
> 
> I have defined two entities whose corresponding classes both inherit from
> the same class.
> ie. Entity A and Entity B are both inheriting from class C.
> 
> <mappedsuperclass C>
> 
> <entityA>
> <entityB>
> 
> When ever I am writing to A, there is no problem.. when ever I am trying
> to write to B, I get the exception in the subject line.
> 
> Can anyone help?
> Thanks
> 



-- 
View this message in context: 
http://www.nabble.com/org.springframework.dao.InvalidDataAccessApiUsageException%3A-Encountered-unmanaged-object-tf4779217.html#a13673209
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to