You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Arun Nagarajan <an...@in.ibm.com> on 2008/06/25 19:32:55 UTC

Using acces-type PROPERTY

Hi,
        I have a set of java classes which has only setter and getter 
methods (as they are generated using XML beans). At the entity level, I 
have defined the access as 'PROPERTY'.  But when I try to persist them, I 
am getting the following error. Can you please let me know how to persist 
java classes, which have only getter and setter methods.

Fields "com.ibm.retail.Product$InnerProduct.innerDesc, 
com.ibm.retail.Product$InnerProduct.innerName" are not a default 
persistent type, and do not have any annotations indicating their 
persistence strategy.  If you do not want these fields to be persisted, 
annotate them with @Transient.

The mapping.xml reads like this. The InnerProduct class has getInnerName 
and getInnerDesc as well as setInnerName and setInnerDesc methods. No 
fields.

<entity class="com.ibm.retail.Product$InnerProduct" access="PROPERTY">
           <table name="PRODUCT"/>
           <attributes>
              <basic name="InnerName">
                 <column name="NAME"/>
              </basic>
              <basic name="InnerDesc">
                 <column name="DESCRIPTION"/>
              </basic>
           </attributes>
        </entity>

Thanks and Regards,
arun...
------------------------------------------------------------------------------------------------------------------------
Arun N, 
IBM
------------------------------------------------------------------------------------------------------------------------

Re: Using acces-type PROPERTY

Posted by Patrick Linskey <pl...@gmail.com>.
Hi,

Can you post the source file and the full stack trace? Also, just in  
case something is going wrong with inner class support, could you try  
moving InnerProduct to be a top-level class?

-Patrick

On Jun 25, 2008, at 10:32 AM, Arun Nagarajan wrote:

> Hi,
>        I have a set of java classes which has only setter and getter
> methods (as they are generated using XML beans). At the entity  
> level, I
> have defined the access as 'PROPERTY'.  But when I try to persist  
> them, I
> am getting the following error. Can you please let me know how to  
> persist
> java classes, which have only getter and setter methods.
>
> Fields "com.ibm.retail.Product$InnerProduct.innerDesc,
> com.ibm.retail.Product$InnerProduct.innerName" are not a default
> persistent type, and do not have any annotations indicating their
> persistence strategy.  If you do not want these fields to be  
> persisted,
> annotate them with @Transient.
>
> The mapping.xml reads like this. The InnerProduct class has  
> getInnerName
> and getInnerDesc as well as setInnerName and setInnerDesc methods. No
> fields.
>
> <entity class="com.ibm.retail.Product$InnerProduct" access="PROPERTY">
>           <table name="PRODUCT"/>
>           <attributes>
>              <basic name="InnerName">
>                 <column name="NAME"/>
>              </basic>
>              <basic name="InnerDesc">
>                 <column name="DESCRIPTION"/>
>              </basic>
>           </attributes>
>        </entity>
>
> Thanks and Regards,
> arun...
> ------------------------------------------------------------------------------------------------------------------------
> Arun N,
> IBM
> ------------------------------------------------------------------------------------------------------------------------

-- 
Patrick Linskey
202 669 5907


Re: Using acces-type PROPERTY

Posted by Craig L Russell <Cr...@Sun.COM>.
Hi Arun,

Do you have any identity property in your beans? The missing identity  
property might be disguised as wrong default for the other persistent  
properties.

And what Patrick says...

Craig

On Jun 25, 2008, at 10:32 AM, Arun Nagarajan wrote:

> Hi,
>        I have a set of java classes which has only setter and getter
> methods (as they are generated using XML beans). At the entity  
> level, I
> have defined the access as 'PROPERTY'.  But when I try to persist  
> them, I
> am getting the following error. Can you please let me know how to  
> persist
> java classes, which have only getter and setter methods.
>
> Fields "com.ibm.retail.Product$InnerProduct.innerDesc,
> com.ibm.retail.Product$InnerProduct.innerName" are not a default
> persistent type, and do not have any annotations indicating their
> persistence strategy.  If you do not want these fields to be  
> persisted,
> annotate them with @Transient.
>
> The mapping.xml reads like this. The InnerProduct class has  
> getInnerName
> and getInnerDesc as well as setInnerName and setInnerDesc methods. No
> fields.
>
> <entity class="com.ibm.retail.Product$InnerProduct" access="PROPERTY">
>           <table name="PRODUCT"/>
>           <attributes>
>              <basic name="InnerName">
>                 <column name="NAME"/>
>              </basic>
>              <basic name="InnerDesc">
>                 <column name="DESCRIPTION"/>
>              </basic>
>           </attributes>
>        </entity>
>
> Thanks and Regards,
> arun...
> ------------------------------------------------------------------------------------------------------------------------
> Arun N,
> IBM
> ------------------------------------------------------------------------------------------------------------------------

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!