You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Praveen G <pr...@emagia.com> on 2007/05/24 16:06:17 UTC

Help: Failing the build when written orm.xml file

Hi,

We are struck with 2 problems: 

    1. We have written orm.xml file for our application and we are getting the following exception. We are also attaching our orm.xml and persistance.xml files for your reference.


 [openjpac] 6281  host  TRACE  [main] openjpa.MetaData - parsePersistentTypeNames() found [com.vormetric.server.dao.user.UserDTO, com.vormetric.server.dao.user.RoleDTO].
 [openjpac] 6281  host  TRACE  [main] openjpa.MetaData - Found 2 classes with metadata in 46 milliseconds.
 [openjpac] 6344  host  TRACE  [main] openjpa.MetaData - Parsing class "com.vormetric.server.dao.user.RoleDTO".
 [openjpac] 6344  host  TRACE  [main] openjpa.Enhance - Enhancing type "class com.vormetric.server.dao.user.RoleDTO".
 [openjpac] 6344  host  WARN   [main] openjpa.Enhance - Type "class com.vormetric.server.dao.user.RoleDTO" has no metadata; enhancing as persistence aware. If you intended for "class com.vormetric.server.dao.user.RoleDTO" to be persistence-capable, then this means that OpenJPA could not find any metadata for "class com.vormetric.server.dao.user.RoleDTO". This can happen if the directory containing your metadata is not in your CLASSPATH, or if your metadata files are not named properly. See the documentation on metadata placement for more information.
 [openjpac] 6344  host  TRACE  [main] openjpa.Tool - The class does not have metadata - enhanced as persistence-aware.
 [openjpac] 6391  host  TRACE  [main] openjpa.Tool - Enhancer running on type "class com.vormetric.server.dao.user.UserDTO".
 [openjpac] 6422  host  TRACE  [main] openjpa.MetaData - Loading metadata for "class com.vormetric.server.dao.user.UserDTO" under mode "[META][QUERY]".
 [openjpac] 6422  host  TRACE  [main] openjpa.MetaData - Parsing class "com.vormetric.server.dao.user.UserDTO".
 [openjpac] 6422  host  TRACE  [main] openjpa.Enhance - Enhancing type "class com.vormetric.server.dao.user.UserDTO".
 [openjpac] 6422  host  WARN   [main] openjpa.Enhance - Type "class com.vormetric.server.dao.user.UserDTO" has no metadata; enhancing as persistence aware. If you intended for "class com.vormetric.server.dao.user.UserDTO" to be persistence-capable, then this means that OpenJPA could not find any metadata for "class com.vormetric.server.dao.user.UserDTO". This can happen if the directory containing your metadata is not in your CLASSPATH, or if your metadata files are not named properly. See the documentation on metadata placement for more information.
 [openjpac] 6422  host  TRACE  [main] openjpa.Tool - The class does not have metadata - enhanced as persistence-aware.
 [openjpac] 6453  host  TRACE  [main] openjpa.MetaData - Clearing metadata repository "org.apache.openjpa.meta.MetaDataRepository@be76c7".


    2. To make an entity readonly in an application(described below).

    
    Please help us in resolving these two problems as we have struck with these two problems. We are not able to findout where exactly is the mistake in our configurations.

Thanks,
Praveen Kumar.

  ----- Original Message ----- 
  From: Praveen G 
  To: open-jpa-dev@incubator.apache.org ; Patrick Linskey 
  Cc: Budigam Srinivas Rao ; Murali Adiraju ; Deven Kalra ; Lane Bauldry 
  Sent: Wednesday, May 23, 2007 8:41 PM
  Subject: Re: Problem with Entity Cache


  Hi,

  Please help us in resolving the following problem.

  Thanks,
  Praveen Kumar.

    ----- Original Message ----- 
    From: Praveen G 
    To: open-jpa-dev@incubator.apache.org ; Patrick Linskey 
    Cc: Budigam Srinivas Rao ; Murali Adiraju 
    Sent: Tuesday, May 22, 2007 8:27 PM
    Subject: Problem with Entity Cache


    Hello Patrick Linskey,

    We are facing the following problem in our project. 

    <0.9.7-incubating fatal user error> org.apache.openjpa.persistence.InvalidStateException: Encountered unmanaged object "com.vormetric.server.dao.user.RoleDTO@51ac51ac" in persistent field "com.vormetric.server.dao.user.UserDTO.roles<element:class com.vormetric.server.dao.user.RoleDTO>" of managed object "com.vormetric.server.dao.user.UserDTO@4f164f16" during flush.  However, this field does not allow cascade persist.  You cannot flush unmanaged objects.
    FailedObject: com.vormetric.server.dao.user.RoleDTO@51ac51ac
     at org.apache.openjpa.kernel.SingleFieldManager.preFlushPC(SingleFieldManager.java:750)
     at org.apache.openjpa.kernel.SingleFieldManager.preFlushPCs(SingleFieldManager.java:732)
     at org.apache.openjpa.kernel.SingleFieldManager.preFlush(SingleFieldManager.java:634)
     at org.apache.openjpa.kernel.SingleFieldManager.preFlush(SingleFieldManager.java:559)
     at org.apache.openjpa.kernel.SingleFieldManager.preFlush(SingleFieldManager.java:475)
     at org.apache.openjpa.kernel.StateManagerImpl.preFlush(StateManagerImpl.java:2678)
     at org.apache.openjpa.kernel.PNewState.beforeFlush(PNewState.java:39)
     at org.apache.openjpa.kernel.StateManagerImpl.beforeFlush(StateManagerImpl.java:854)
     at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1903)
     at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1863)
     at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1634)
     at org.apache.openjpa.kernel.StateManagerImpl.assignObjectId(StateManagerImpl.java:478)
     at org.apache.openjpa.kernel.StateManagerImpl.assignField(StateManagerImpl.java:558)
     at org.apache.openjpa.kernel.StateManagerImpl.beforeAccessField(StateManagerImpl.java:1365)
     at org.apache.openjpa.kernel.StateManagerImpl.accessingField(StateManagerImpl.java:1348)
     at com.vormetric.server.dao.user.UserDTO.pcGetid(UserDTO.java)
     at com.vormetric.server.dao.user.UserDTO.getId(UserDTO.java:93)
     at com.vormetric.server.dao.user.hibernate.UserDAOImpl.create(UserDAOImpl.java:89)
     at com.vormetric.server.sdk.user.UserManager.addUser(UserManager.java:52)
     at com.vormetric.server.mgmt.console.user.UserAddAction.execute(UserAddAction.java:67)


    We are having 2 entity classes UserDTO and RoleDTO files. We want the RoleDTO entity to be readonly.
    So Please help us to make an entity readonly in an application.

    The following is the tag in our existing hibernate mapping file. We are replacing the hibernate code with OpenJPA code

    <hibernate-mapping>
        <class name="com.vormetric.server.dao.user.RoleDTO" table="CGSS_ROLE">
      <cache usage="read-only"/>

    So please help us as soon as possible, to make an entity readonly.

    Thanks,
    Praveen Kumar.


Re: Help: Failing the build when written orm.xml file

Posted by Marc Prud'hommeaux <mp...@apache.org>.
Praveen-

On May 24, 2007, at 7:06 AM, Praveen G wrote:

> Hi,
>
> We are struck with 2 problems:
>
>     1. We have written orm.xml file for our application and we are  
> getting the following exception. We are also attaching our orm.xml  
> and persistance.xml files for your reference.
>
>
>  [openjpac] 6281  host  TRACE  [main] openjpa.MetaData -  
> parsePersistentTypeNames() found  
> [com.vormetric.server.dao.user.UserDTO,  
> com.vormetric.server.dao.user.RoleDTO].
>  [openjpac] 6281  host  TRACE  [main] openjpa.MetaData - Found 2  
> classes with metadata in 46 milliseconds.
>  [openjpac] 6344  host  TRACE  [main] openjpa.MetaData - Parsing  
> class "com.vormetric.server.dao.user.RoleDTO".
>  [openjpac] 6344  host  TRACE  [main] openjpa.Enhance - Enhancing  
> type "class com.vormetric.server.dao.user.RoleDTO".
>  [openjpac] 6344  host  WARN   [main] openjpa.Enhance - Type "class  
> com.vormetric.server.dao.user.RoleDTO" has no metadata; enhancing  
> as persistence aware. If you intended for "class  
> com.vormetric.server.dao.user.RoleDTO" to be persistence-capable,  
> then this means that OpenJPA could not find any metadata for "class  
> com.vormetric.server.dao.user.RoleDTO". This can happen if the  
> directory containing your metadata is not in your CLASSPATH, or if  
> your metadata files are not named properly. See the documentation  
> on metadata placement for more information.
>  [openjpac] 6344  host  TRACE  [main] openjpa.Tool - The class does  
> not have metadata - enhanced as persistence-aware.
>  [openjpac] 6391  host  TRACE  [main] openjpa.Tool - Enhancer  
> running on type "class com.vormetric.server.dao.user.UserDTO".
>  [openjpac] 6422  host  TRACE  [main] openjpa.MetaData - Loading  
> metadata for "class com.vormetric.server.dao.user.UserDTO" under  
> mode "[META][QUERY]".
>  [openjpac] 6422  host  TRACE  [main] openjpa.MetaData - Parsing  
> class "com.vormetric.server.dao.user.UserDTO".
>  [openjpac] 6422  host  TRACE  [main] openjpa.Enhance - Enhancing  
> type "class com.vormetric.server.dao.user.UserDTO".
>  [openjpac] 6422  host  WARN   [main] openjpa.Enhance - Type "class  
> com.vormetric.server.dao.user.UserDTO" has no metadata; enhancing  
> as persistence aware. If you intended for "class  
> com.vormetric.server.dao.user.UserDTO" to be persistence-capable,  
> then this means that OpenJPA could not find any metadata for "class  
> com.vormetric.server.dao.user.UserDTO". This can happen if the  
> directory containing your metadata is not in your CLASSPATH, or if  
> your metadata files are not named properly. See the documentation  
> on metadata placement for more information.
>  [openjpac] 6422  host  TRACE  [main] openjpa.Tool - The class does  
> not have metadata - enhanced as persistence-aware.
>  [openjpac] 6453  host  TRACE  [main] openjpa.MetaData - Clearing  
> metadata repository  
> "org.apache.openjpa.meta.MetaDataRepository@be76c7".


Nothing strikes me as being incorrect about your persistence.xml or  
orm.xml. Are these files available in the META-INF/ directory at the  
root of one of your classpaths? How are you running the enhancer?

If you can run it with verbose logging (e.g., by setting the property  
"openjpa.Log: DefaultLevel=TRACE"), can you send us the output, as  
well as the exact setting of your CLASSPATH environment variable and  
the location of your persistence.xml and orm.xml files?


>      2. To make an entity readonly in an application(described below).

We don't have any support for declaring that an object be read-only.  
Can you describe more in-depth the scenario in which you need to have  
instances be marked read-only (as opposed to being just de-facto read- 
only by way of just never making changes to the instances)?



>        Please help us in resolving these two problems as we have  
> struck with these two problems. We are not able to findout where  
> exactly is the mistake in our configurations.
>
> Thanks,
> Praveen Kumar.
>
> ----- Original Message -----
> From: Praveen G
> To: open-jpa-dev@incubator.apache.org ; Patrick Linskey
> Cc: Budigam Srinivas Rao ; Murali Adiraju ; Deven Kalra ; Lane Bauldry
> Sent: Wednesday, May 23, 2007 8:41 PM
> Subject: Re: Problem with Entity Cache
>
> Hi,
>
> Please help us in resolving the following problem.
>
> Thanks,
> Praveen Kumar.
>
> ----- Original Message -----
> From: Praveen G
> To: open-jpa-dev@incubator.apache.org ; Patrick Linskey
> Cc: Budigam Srinivas Rao ; Murali Adiraju
> Sent: Tuesday, May 22, 2007 8:27 PM
> Subject: Problem with Entity Cache
>
> Hello Patrick Linskey,
>
> We are facing the following problem in our project.
>
> <0.9.7-incubating fatal user error>  
> org.apache.openjpa.persistence.InvalidStateException: Encountered  
> unmanaged object "com.vormetric.server.dao.user.RoleDTO@51ac51ac"  
> in persistent field  
> "com.vormetric.server.dao.user.UserDTO.roles<element:class  
> com.vormetric.server.dao.user.RoleDTO>" of managed object  
> "com.vormetric.server.dao.user.UserDTO@4f164f16" during flush.   
> However, this field does not allow cascade persist.  You cannot  
> flush unmanaged objects.
> FailedObject: com.vormetric.server.dao.user.RoleDTO@51ac51ac
>  at org.apache.openjpa.kernel.SingleFieldManager.preFlushPC 
> (SingleFieldManager.java:750)
>  at org.apache.openjpa.kernel.SingleFieldManager.preFlushPCs 
> (SingleFieldManager.java:732)
>  at org.apache.openjpa.kernel.SingleFieldManager.preFlush 
> (SingleFieldManager.java:634)
>  at org.apache.openjpa.kernel.SingleFieldManager.preFlush 
> (SingleFieldManager.java:559)
>  at org.apache.openjpa.kernel.SingleFieldManager.preFlush 
> (SingleFieldManager.java:475)
>  at org.apache.openjpa.kernel.StateManagerImpl.preFlush 
> (StateManagerImpl.java:2678)
>  at org.apache.openjpa.kernel.PNewState.beforeFlush(PNewState.java:39)
>  at org.apache.openjpa.kernel.StateManagerImpl.beforeFlush 
> (StateManagerImpl.java:854)
>  at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1903)
>  at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java: 
> 1863)
>  at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1634)
>  at org.apache.openjpa.kernel.StateManagerImpl.assignObjectId 
> (StateManagerImpl.java:478)
>  at org.apache.openjpa.kernel.StateManagerImpl.assignField 
> (StateManagerImpl.java:558)
>  at org.apache.openjpa.kernel.StateManagerImpl.beforeAccessField 
> (StateManagerImpl.java:1365)
>  at org.apache.openjpa.kernel.StateManagerImpl.accessingField 
> (StateManagerImpl.java:1348)
>  at com.vormetric.server.dao.user.UserDTO.pcGetid(UserDTO.java)
>  at com.vormetric.server.dao.user.UserDTO.getId(UserDTO.java:93)
>  at com.vormetric.server.dao.user.hibernate.UserDAOImpl.create 
> (UserDAOImpl.java:89)
>  at com.vormetric.server.sdk.user.UserManager.addUser 
> (UserManager.java:52)
>  at com.vormetric.server.mgmt.console.user.UserAddAction.execute 
> (UserAddAction.java:67)
>
> We are having 2 entity classes UserDTO and RoleDTO files. We want  
> the RoleDTO entity to be readonly.
> So Please help us to make an entity readonly in an application.
>
> The following is the tag in our existing hibernate mapping file. We  
> are replacing the hibernate code with OpenJPA code
>
> <hibernate-mapping>
>     <class name="com.vormetric.server.dao.user.RoleDTO"  
> table="CGSS_ROLE">
>   <cache usage="read-only"/>
> So please help us as soon as possible, to make an entity readonly.
>
> Thanks,
> Praveen Kumar.
>
>
> <persistence.xml>
> <orm.xml>