Re: Date Problem

2010-07-15 Thread Rick Curtis
Can you post your persistence.xml file?

Thanks,
Rick


Re: Date Problem

2010-07-15 Thread jingmeifan

Thanks Rick for your responding, do you mean there is any configuration in
persistence.xml?
My file is very simple:

?xml version=1.0 encoding=UTF-8?
persistence xmlns=http://java.sun.com/xml/ns/persistence;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 version=1.0
persistence-unit name=PersistenceUnit
   
providerorg.apache.openjpa.persistence.PersistenceProviderImpl/provider

   
classmodel.Message/class

properties
property name=openjpa.Log value=DefaultLevel=TRACE/
!--property name=openjpa.log value=DefaultLevel=WARN,
Runtime=INFO, Tool=INFO/--
/properties
/persistence-unit
/persistence
-- 
View this message in context: 
http://openjpa.208410.n2.nabble.com/Date-Problem-tp2943310p5297788.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Date Problem

2010-07-15 Thread Rick Curtis
Try changing version=1.0 to version=2.0 and removing don't use the
detachCopy method. I think that this is a bug that I reported [1] a while
back.

Thanks,
Rick

[1] https://issues.apache.org/jira/browse/OPENJPA-1672


Re: Date Problem

2010-07-15 Thread jingmeifan

I tried changing version=2.0, and using detach on em, but the entity still
did detached. :(

persistence xmlns=http://java.sun.com/xml/ns/persistence;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 version=2.0

This is the only place to change the version, where am I still missing?

Thanks,
Jane
-- 
View this message in context: 
http://openjpa.208410.n2.nabble.com/Date-Problem-tp2943310p5298075.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Date Problem

2010-07-15 Thread jingmeifan

Sorry, I mean the entity didn't been detached.
-- 
View this message in context: 
http://openjpa.208410.n2.nabble.com/Date-Problem-tp2943310p5298472.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Date Problem

2010-07-15 Thread Rick Curtis
Hmm, can you post a small unit test?

Thanks,
Rick


Re: Date Problem

2010-07-15 Thread Rick Curtis
Sorry, I am afraid I cannot.
Without at minimum a snippet of code it's pretty hard to help you out.

 Would you please let men know what bug on detachCopy method?
I'm not sure what you're asking here.

 if I get em from jpaTample, and from em find data, do I need always close
em after?
I'm not sure what jpaTample is. You'll need to close your em once you're
done with it. It depends from application to application.

hth,
Rick


Re: Date Problem

2010-07-15 Thread jingmeifan

Sorry, I am afraid I cannot. 
Without at minimum a snippet of code it's pretty hard to help you out. 
- Sorry again, right now detachCopy method of OpenJPAEntityManager can solve
my problem.

 Would you please let me know what bug on detachCopy method? 
I'm not sure what you're asking here. 

- The question is coming from your response:
Try changing version=1.0 to version=2.0 and removing don't use the 
detachCopy method. I think that this is a bug that I reported [1] a while 
back. 

[1] https://issues.apache.org/jira/browse/OPENJPA-1672;

 if I get em from jpaTample, and from em find data, do I need always close 
em after? 
I'm not sure what jpaTample is. You'll need to close your em once you're 
done with it. It depends from application to application. 
- Right now I close em after I get result back from there.

Thanks,
Jane
Rick Curtis wrote:
 
Sorry, I am afraid I cannot.
 Without at minimum a snippet of code it's pretty hard to help you out.
 
 Would you please let men know what bug on detachCopy method?
 I'm not sure what you're asking here.
 
 if I get em from jpaTample, and from em find data, do I need always close
 em after?
 I'm not sure what jpaTample is. You'll need to close your em once you're
 done with it. It depends from application to application.
 
 hth,
 Rick
 
 
-- 
View this message in context: 
http://openjpa.208410.n2.nabble.com/Date-Problem-tp2943310p5298968.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Date Problem

2010-07-14 Thread jingmeifan

I have the same problem and try many ways still stuck in the Date type, the
object data cannot be send out due to
org.apache.openjpa.util.java$util$Date$proxy, both detach() and clear() are
not working for me. How can I get rid of this type?

Thanks,
Jane
-- 
View this message in context: 
http://openjpa.208410.n2.nabble.com/Date-Problem-tp2943310p5294791.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Date Problem

2010-07-14 Thread Rick Curtis
What version of OpenJPA are you on?

Thanks,
Rick


Re: Date Problem

2010-07-14 Thread jingmeifan

Thank you for quick responding. I am using openjpa 2.0.0, the latest version.
-- 
View this message in context: 
http://openjpa.208410.n2.nabble.com/Date-Problem-tp2943310p5295621.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Date Problem

2009-05-21 Thread Kevin Sutter
Just to complete my findings from the earlier post...  Here's a reference
[1] to the previous, recent discussion on the detach vs clear processing.
This particular customer problem ended up being a problem with Hessian
serialization, but it still looks like our detachment processing is not the
same between detach and clear.

I also found this unfinished discussion between Pinaki and myself about a
similar situation [2].  I can understand the need to track changes in a
detached state for efficiency reasons.  But, this should be configurable.
And, per the earlier comment, we need to be consistent.

I searched for an existing JIRA Issue, and I couldn't find one.  So, I
created OPENJPA-1097 [3] to track this problem.

Thanks,
Kevin

[1]  http://n2.nabble.com/AutoDetach-td2868435.html#a2884042
[2]
http://n2.nabble.com/Re%3A-Is-java.util.date-not-supported-by-remote-interface---td667769.html#a667769
[3]  https://issues.apache.org/jira/browse/OPENJPA-1097

On Wed, May 20, 2009 at 2:46 PM, Michael Dick michael.d.d...@gmail.comwrote:

 In general I agree, I just sent on the reply from earlier to help Russell
 get going.

 Opening a JIRA is a good idea, I think this warrants some further
 investigation and I hadn't noticed the discrepancy between detach() and
 clear()..

 -mike

 On Wed, May 20, 2009 at 9:49 AM, Kevin Sutter kwsut...@gmail.com wrote:

  Mike,
  I think that our detached entities should remove any dependencies on
  OpenJPA
  binaries.  From one of the recent forum postings, it sounds like the
  detachment works on an individual detach() invocation and not with the
  clear() invocation (or vice versa -- my memory isn't very good this
  morning).  We need to be consistent and remove this dependency.  I
 thought
  we had a JIRA on this topic, but I can't find that either.  Must be
 getting
  old...
 
  Comments?
  Kevin
 
  On Wed, May 20, 2009 at 9:16 AM, Michael Dick michael.d.d...@gmail.com
  wrote:
 
   Hi Russell,
  
   I think you're hitting the same problem mentioned here  [1]. The short
   answer is that the client needs to have access to openjpa-1.2.1.jar so
 it
   can load the proxy classes.
  
   The larger question is whether OpenJPA should (or could) serialize to a
   non-proxy type to prevent this problem. I don't see the answer in the
   previous thread, but some additonal markmail or nabble searching may
 find
   it.
  
   [1] http://markmail.org/thread/2dmgcbnw6yo7b77n
  
   Hope this helps,
  
   -mike
  
   On Wed, May 20, 2009 at 7:18 AM, is_maximum mnr...@gmail.com wrote:
  
   
Have you tried java.util.Date instead of java.sql.Date ?
   
   
Russell Collins wrote:

 Hello, I am new to OpenJPA and the entire persistence objects so
 bear
with
 me a little.  First of all, I am using Apache Geronimo which has
   OpenJPA
 version1.2.1 and I am moving from Hibernate (which is a pain to try
  to
 work in Geronimo).  Everything works fine except for Dates and
 Times.
I
 have an Embedded class that starts off like this:


 @Embeddable
 public class EntityChange implements Serializable {


   private static final long serialVersionUID = 1L;

   @Column(name = changedate )
   @Temporal(DATE)
   private Date changeDate;

   @Column(name = changetime)
   @Temporal(TIME)
   private Time changeTime;

   @Column(name = changeuser)
   private String changeUser;


 When I try to grab an object with these embedded values I get the
   error:



 java.lang.AssertionError: javax.ejb.EJBException: Unknown Container
 Exception: java.rmi.RemoteException: Cannot read the response from
  the
 server.  The class for an object being returned is not located in
  this
 system:; nested exception is:
 java.lang.ClassNotFoundException:
 org.apache.openjpa.util.java$sql$Date$proxy

 I have tried multiple ways with adding and removing @Temporal etc.
   Oh
one
 more thing, this is a MySQL database that I am trying to access.
Please
 give me any help you can.  Thanks.


 Russell Collins



   
--
View this message in context:
http://n2.nabble.com/Date-Problem-tp2943310p2945766.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
   
   
  
 



Re: Date Problem

2009-05-20 Thread is_maximum

Have you tried java.util.Date instead of java.sql.Date ?


Russell Collins wrote:
 
 Hello, I am new to OpenJPA and the entire persistence objects so bear with
 me a little.  First of all, I am using Apache Geronimo which has OpenJPA
 version1.2.1 and I am moving from Hibernate (which is a pain to try to
 work in Geronimo).  Everything works fine except for Dates and Times.  I
 have an Embedded class that starts off like this:
 
 
 @Embeddable
 public class EntityChange implements Serializable {
 
 
   private static final long serialVersionUID = 1L;
 
   @Column(name = changedate )
   @Temporal(DATE)
   private Date changeDate;
 
   @Column(name = changetime)
   @Temporal(TIME)
   private Time changeTime;
 
   @Column(name = changeuser)
   private String changeUser;
 
 
 When I try to grab an object with these embedded values I get the error:
 
 
 
 java.lang.AssertionError: javax.ejb.EJBException: Unknown Container
 Exception: java.rmi.RemoteException: Cannot read the response from the
 server.  The class for an object being returned is not located in this
 system:; nested exception is:
 java.lang.ClassNotFoundException:
 org.apache.openjpa.util.java$sql$Date$proxy
 
 I have tried multiple ways with adding and removing @Temporal etc.  Oh one
 more thing, this is a MySQL database that I am trying to access.  Please
 give me any help you can.  Thanks.
 
 
 Russell Collins
 
 
 

-- 
View this message in context: 
http://n2.nabble.com/Date-Problem-tp2943310p2945766.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



Re: Date Problem

2009-05-20 Thread Michael Dick
Hi Russell,

I think you're hitting the same problem mentioned here  [1]. The short
answer is that the client needs to have access to openjpa-1.2.1.jar so it
can load the proxy classes.

The larger question is whether OpenJPA should (or could) serialize to a
non-proxy type to prevent this problem. I don't see the answer in the
previous thread, but some additonal markmail or nabble searching may find
it.

[1] http://markmail.org/thread/2dmgcbnw6yo7b77n

Hope this helps,

-mike

On Wed, May 20, 2009 at 7:18 AM, is_maximum mnr...@gmail.com wrote:


 Have you tried java.util.Date instead of java.sql.Date ?


 Russell Collins wrote:
 
  Hello, I am new to OpenJPA and the entire persistence objects so bear
 with
  me a little.  First of all, I am using Apache Geronimo which has OpenJPA
  version1.2.1 and I am moving from Hibernate (which is a pain to try to
  work in Geronimo).  Everything works fine except for Dates and Times.  I
  have an Embedded class that starts off like this:
 
 
  @Embeddable
  public class EntityChange implements Serializable {
 
 
private static final long serialVersionUID = 1L;
 
@Column(name = changedate )
@Temporal(DATE)
private Date changeDate;
 
@Column(name = changetime)
@Temporal(TIME)
private Time changeTime;
 
@Column(name = changeuser)
private String changeUser;
 
 
  When I try to grab an object with these embedded values I get the error:
 
 
 
  java.lang.AssertionError: javax.ejb.EJBException: Unknown Container
  Exception: java.rmi.RemoteException: Cannot read the response from the
  server.  The class for an object being returned is not located in this
  system:; nested exception is:
  java.lang.ClassNotFoundException:
  org.apache.openjpa.util.java$sql$Date$proxy
 
  I have tried multiple ways with adding and removing @Temporal etc.  Oh
 one
  more thing, this is a MySQL database that I am trying to access.  Please
  give me any help you can.  Thanks.
 
 
  Russell Collins
 
 
 

 --
 View this message in context:
 http://n2.nabble.com/Date-Problem-tp2943310p2945766.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.




RE: Date Problem

2009-05-20 Thread Russell Collins
Thanks Mike.  I included openjpa-1.2.1.jar in my client app and everything 
works great.


Russell Collins
Sr. Software Engineer
McLane Advanced Technology

Do or do not, there is no try. - Yoda


-Original Message-
From: Michael Dick [mailto:michael.d.d...@gmail.com]
Sent: Wednesday, May 20, 2009 9:17 AM
To: users@openjpa.apache.org
Subject: Re: Date Problem

Hi Russell,

I think you're hitting the same problem mentioned here  [1]. The short
answer is that the client needs to have access to openjpa-1.2.1.jar so it
can load the proxy classes.

The larger question is whether OpenJPA should (or could) serialize to a
non-proxy type to prevent this problem. I don't see the answer in the
previous thread, but some additonal markmail or nabble searching may find
it.

[1] http://markmail.org/thread/2dmgcbnw6yo7b77n

Hope this helps,

-mike

On Wed, May 20, 2009 at 7:18 AM, is_maximum mnr...@gmail.com wrote:


 Have you tried java.util.Date instead of java.sql.Date ?


 Russell Collins wrote:
 
  Hello, I am new to OpenJPA and the entire persistence objects so bear
 with
  me a little.  First of all, I am using Apache Geronimo which has OpenJPA
  version1.2.1 and I am moving from Hibernate (which is a pain to try to
  work in Geronimo).  Everything works fine except for Dates and Times.  I
  have an Embedded class that starts off like this:
 
 
  @Embeddable
  public class EntityChange implements Serializable {
 
 
private static final long serialVersionUID = 1L;
 
@Column(name = changedate )
@Temporal(DATE)
private Date changeDate;
 
@Column(name = changetime)
@Temporal(TIME)
private Time changeTime;
 
@Column(name = changeuser)
private String changeUser;
 
 
  When I try to grab an object with these embedded values I get the error:
 
 
 
  java.lang.AssertionError: javax.ejb.EJBException: Unknown Container
  Exception: java.rmi.RemoteException: Cannot read the response from the
  server.  The class for an object being returned is not located in this
  system:; nested exception is:
  java.lang.ClassNotFoundException:
  org.apache.openjpa.util.java$sql$Date$proxy
 
  I have tried multiple ways with adding and removing @Temporal etc.  Oh
 one
  more thing, this is a MySQL database that I am trying to access.  Please
  give me any help you can.  Thanks.
 
 
  Russell Collins
 
 
 

 --
 View this message in context:
 http://n2.nabble.com/Date-Problem-tp2943310p2945766.html
 Sent from the OpenJPA Users mailing list archive at Nabble.com.




Re: Date Problem

2009-05-20 Thread Kevin Sutter
Mike,
I think that our detached entities should remove any dependencies on OpenJPA
binaries.  From one of the recent forum postings, it sounds like the
detachment works on an individual detach() invocation and not with the
clear() invocation (or vice versa -- my memory isn't very good this
morning).  We need to be consistent and remove this dependency.  I thought
we had a JIRA on this topic, but I can't find that either.  Must be getting
old...

Comments?
Kevin

On Wed, May 20, 2009 at 9:16 AM, Michael Dick michael.d.d...@gmail.comwrote:

 Hi Russell,

 I think you're hitting the same problem mentioned here  [1]. The short
 answer is that the client needs to have access to openjpa-1.2.1.jar so it
 can load the proxy classes.

 The larger question is whether OpenJPA should (or could) serialize to a
 non-proxy type to prevent this problem. I don't see the answer in the
 previous thread, but some additonal markmail or nabble searching may find
 it.

 [1] http://markmail.org/thread/2dmgcbnw6yo7b77n

 Hope this helps,

 -mike

 On Wed, May 20, 2009 at 7:18 AM, is_maximum mnr...@gmail.com wrote:

 
  Have you tried java.util.Date instead of java.sql.Date ?
 
 
  Russell Collins wrote:
  
   Hello, I am new to OpenJPA and the entire persistence objects so bear
  with
   me a little.  First of all, I am using Apache Geronimo which has
 OpenJPA
   version1.2.1 and I am moving from Hibernate (which is a pain to try to
   work in Geronimo).  Everything works fine except for Dates and Times.
  I
   have an Embedded class that starts off like this:
  
  
   @Embeddable
   public class EntityChange implements Serializable {
  
  
 private static final long serialVersionUID = 1L;
  
 @Column(name = changedate )
 @Temporal(DATE)
 private Date changeDate;
  
 @Column(name = changetime)
 @Temporal(TIME)
 private Time changeTime;
  
 @Column(name = changeuser)
 private String changeUser;
  
  
   When I try to grab an object with these embedded values I get the
 error:
  
  
  
   java.lang.AssertionError: javax.ejb.EJBException: Unknown Container
   Exception: java.rmi.RemoteException: Cannot read the response from the
   server.  The class for an object being returned is not located in this
   system:; nested exception is:
   java.lang.ClassNotFoundException:
   org.apache.openjpa.util.java$sql$Date$proxy
  
   I have tried multiple ways with adding and removing @Temporal etc.  Oh
  one
   more thing, this is a MySQL database that I am trying to access.
  Please
   give me any help you can.  Thanks.
  
  
   Russell Collins
  
  
  
 
  --
  View this message in context:
  http://n2.nabble.com/Date-Problem-tp2943310p2945766.html
  Sent from the OpenJPA Users mailing list archive at Nabble.com.
 
 



Re: Date Problem

2009-05-20 Thread Michael Dick
In general I agree, I just sent on the reply from earlier to help Russell
get going.

Opening a JIRA is a good idea, I think this warrants some further
investigation and I hadn't noticed the discrepancy between detach() and
clear()..

-mike

On Wed, May 20, 2009 at 9:49 AM, Kevin Sutter kwsut...@gmail.com wrote:

 Mike,
 I think that our detached entities should remove any dependencies on
 OpenJPA
 binaries.  From one of the recent forum postings, it sounds like the
 detachment works on an individual detach() invocation and not with the
 clear() invocation (or vice versa -- my memory isn't very good this
 morning).  We need to be consistent and remove this dependency.  I thought
 we had a JIRA on this topic, but I can't find that either.  Must be getting
 old...

 Comments?
 Kevin

 On Wed, May 20, 2009 at 9:16 AM, Michael Dick michael.d.d...@gmail.com
 wrote:

  Hi Russell,
 
  I think you're hitting the same problem mentioned here  [1]. The short
  answer is that the client needs to have access to openjpa-1.2.1.jar so it
  can load the proxy classes.
 
  The larger question is whether OpenJPA should (or could) serialize to a
  non-proxy type to prevent this problem. I don't see the answer in the
  previous thread, but some additonal markmail or nabble searching may find
  it.
 
  [1] http://markmail.org/thread/2dmgcbnw6yo7b77n
 
  Hope this helps,
 
  -mike
 
  On Wed, May 20, 2009 at 7:18 AM, is_maximum mnr...@gmail.com wrote:
 
  
   Have you tried java.util.Date instead of java.sql.Date ?
  
  
   Russell Collins wrote:
   
Hello, I am new to OpenJPA and the entire persistence objects so bear
   with
me a little.  First of all, I am using Apache Geronimo which has
  OpenJPA
version1.2.1 and I am moving from Hibernate (which is a pain to try
 to
work in Geronimo).  Everything works fine except for Dates and Times.
   I
have an Embedded class that starts off like this:
   
   
@Embeddable
public class EntityChange implements Serializable {
   
   
  private static final long serialVersionUID = 1L;
   
  @Column(name = changedate )
  @Temporal(DATE)
  private Date changeDate;
   
  @Column(name = changetime)
  @Temporal(TIME)
  private Time changeTime;
   
  @Column(name = changeuser)
  private String changeUser;
   
   
When I try to grab an object with these embedded values I get the
  error:
   
   
   
java.lang.AssertionError: javax.ejb.EJBException: Unknown Container
Exception: java.rmi.RemoteException: Cannot read the response from
 the
server.  The class for an object being returned is not located in
 this
system:; nested exception is:
java.lang.ClassNotFoundException:
org.apache.openjpa.util.java$sql$Date$proxy
   
I have tried multiple ways with adding and removing @Temporal etc.
  Oh
   one
more thing, this is a MySQL database that I am trying to access.
   Please
give me any help you can.  Thanks.
   
   
Russell Collins
   
   
   
  
   --
   View this message in context:
   http://n2.nabble.com/Date-Problem-tp2943310p2945766.html
   Sent from the OpenJPA Users mailing list archive at Nabble.com.