You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "sharath.h (JIRA)" <ji...@apache.org> on 2007/04/05 21:59:32 UTC
[jira] Created: (OPENJPA-204) Nesting of Emebedded in Embeddable
element
Nesting of Emebedded in Embeddable element
------------------------------------------
Key: OPENJPA-204
URL: https://issues.apache.org/jira/browse/OPENJPA-204
Project: OpenJPA
Issue Type: Bug
Components: jpa
Affects Versions: 0.9.6
Reporter: sharath.h
Hi,
In orm_1_0.xsd or orm-xsd.rsrc files under the <xsd:complexType name="embeddable-attributes"> the <xsd:element name="embedded" type="orm:embedded" minOccurs="0" maxOccurs="unbounded"/> is not present.
Please let me know if there is any valid reason behind it.Was the embedded element in embeddable-attributes was accidently missed out?
I faced the issue when i tried the example something like as shown below:
class A
{
int id;
B objB;
}
class B
{
String str1;
Date d;
C objC;
}
class C
{
String str2;
}
I wanted to persist object A into a single table by having object B as embedded and object B inturn having object C as embedded.
My corresponding orm mapping file is as shown below:
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd" version="1.0">
<entity class="A">
<table name="TableA"/>
<attributes>
<id name="id">
<column name="ID"/>
</id>
<embedded name="objB"/>
</attributes>
</entity>
<embeddable class="B">
<attributes>
<basic name="str1">
<column name="COL2"/>
</basic>
<basic name="d">
<column name="DateCol"/>
</basic>
<embedded name="objC"/>
</embeddable>
<embeddable class="C">
<attributes>
<basic name="str2">
<column name="COL3"/>
</basic>
</embeddable>
</entity-mappings>
This was not possible due to orm schema restriction.
Thanks,
Regards,
Sharath.H
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (OPENJPA-204) Nesting of Emebedded in Embeddable
element
Posted by "Patrick Linskey (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/OPENJPA-204?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Patrick Linskey resolved OPENJPA-204.
-------------------------------------
Resolution: Won't Fix
This is a limitation of the JPA spec. From section 9.1.34:
<spec>Only Basic, Column, Lob, Temporal, and Enumerated mapping annotations may portably be used to map the persistent fields or properties of classes annotated as Embeddable.</spec>
OpenJPA supports embedded fields in embeddable instances, as well as various other usages of embedded things, but those are extensions to the spec. Due to OPENJPA-125, you can only configure nested embeddeds via annotations currently.
Marking this as WNF, although in some ways it might be better closed as a duplicate of OPENJPA-125, since once we resolve OPENJPA-125, there will be a way to do this in XML (albeit not the spec-defined XML).
Note that the JPA spec team defines the orm.xsd; OpenJPA is just an implementation of that spec. So, we can't change the orm.xsd. I believe, however, that this is an issue that the JPA 2 spec team will probably consider.
> Nesting of Emebedded in Embeddable element
> ------------------------------------------
>
> Key: OPENJPA-204
> URL: https://issues.apache.org/jira/browse/OPENJPA-204
> Project: OpenJPA
> Issue Type: Bug
> Components: jpa
> Affects Versions: 0.9.6
> Reporter: sharath.h
>
> Hi,
>
> In orm_1_0.xsd or orm-xsd.rsrc files under the <xsd:complexType name="embeddable-attributes"> the <xsd:element name="embedded" type="orm:embedded" minOccurs="0" maxOccurs="unbounded"/> is not present.
>
> Please let me know if there is any valid reason behind it.Was the embedded element in embeddable-attributes was accidently missed out?
>
> I faced the issue when i tried the example something like as shown below:
>
> class A
> {
> int id;
> B objB;
>
> }
>
> class B
> {
> String str1;
> Date d;
> C objC;
> }
>
> class C
> {
> String str2;
> }
>
> I wanted to persist object A into a single table by having object B as embedded and object B inturn having object C as embedded.
> My corresponding orm mapping file is as shown below:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd" version="1.0">
>
> <entity class="A">
> <table name="TableA"/>
> <attributes>
> <id name="id">
> <column name="ID"/>
> </id>
> <embedded name="objB"/>
> </attributes>
> </entity>
>
> <embeddable class="B">
> <attributes>
> <basic name="str1">
> <column name="COL2"/>
> </basic>
> <basic name="d">
> <column name="DateCol"/>
> </basic>
> <embedded name="objC"/>
> </embeddable>
> <embeddable class="C">
> <attributes>
> <basic name="str2">
> <column name="COL3"/>
> </basic>
> </embeddable>
> </entity-mappings>
>
> This was not possible due to orm schema restriction.
>
>
>
> Thanks,
> Regards,
> Sharath.H
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.