Hello,

 

I am evaluating openJPA to use for our current project.  It works fine
for our need with database.  But I am having problem with the
XMLStoreManager.  I have two simple objects - Customer and User.
Customer can have multiple users.  I look at the object store in xml
file.  It stored like this:

 

<?xml version="1.0" encoding="UTF-8"?>

<extent>

    <object class="net.iss.mss.jpa.examples.remedy.Customer" oid="1"
version="0">

        <field name="customerId">

            "1"

        </field>

        <field name="customerName">

            "customer1"

        </field>

        <field name="users">

            <element>

                org.apache.openjpa.util.StringId:1

            </element>

            <element>

                org.apache.openjpa.util.StringId:2

            </element>

        </field>

    </object>

</extent>

 

Shoud the Users element store User object?  The XMLStoreManager failed
to load data in because it doest not know how to create this object:
org.apache.openjpa.util.StringId:1

 

Please help...

 

I attached my orm.xml and persisentene.xml for your references.

 

 

Sincerely,

 

 

 

Anh Ngo

Senior Application Programmer

IBM Internet Security Systems

248 226 9059

 

<?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">

    <!-- Remedy Entity Mapping -->
    <entity class="net.iss.mss.jpa.examples.remedy.Customer">
        <attributes>
            <id name="customerId"/>
            <basic name="customerName"/>
            <one-to-many name="users" fetch="LAZY" target-entity="net.iss.mss.jpa.examples.remedy.User">
                <order-by/>
                <cascade>
                    <cascade-persist/>
                    <cascade-merge/>
                    <cascade-remove/>
                    <cascade-refresh/>
                    <!-- <cascade-all/> -->
                </cascade>
            </one-to-many>
        </attributes>
    </entity>

    <entity class="net.iss.mss.jpa.examples.remedy.User">
        <attributes>
            <id name="userId"/>
            <basic name="userName"/>
        </attributes>
    </entity>

    <!-- End of Enitiy Mapping -->

</entity-mappings>
<?xml version="1.0" encoding="UTF-8"?>
<!--
 Copyright 2006 The Apache Software Foundation.
 
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
 http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->
<persistence xmlns="http://java.sun.com/xml/ns/persistence";
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
             version="1.0">
<persistence-unit name="IBM Internet Security Systems Remedy JPA" transaction-type="RESOURCE_LOCAL">
        <!--
            The default provider can be OpenJPA, or some other product.
            This element is optional if OpenJPA is the only JPA provider
            in the current classloading environment.
        -->
        <provider>
            org.apache.openjpa.persistence.PersistenceProviderImpl
        </provider>

        <!-- We must enumerate each entity in the persistence unit -->
        <class>net.iss.mss.jpa.examples.remedy.Customer</class>
        <class>net.iss.mss.jpa.examples.remedy.User</class>

        <properties>

            <property name="openjpa.ConnectionURL"
                      value="c:\MSS_Development\Projects\trunk\jpa\remedyData"/>

            <property name="org.apache.openjpa.abstractstore.AbstractStoreManager"
                      value="org.apache.openjpa.xmlstore.XMLStoreManager"/>

            <property name="openjpa.BrokerFactory"
                      value="abstractstore"/>

        </properties>
    </persistence-unit>
</persistence>

Reply via email to