openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: InvalidStateException: Attempt to set column "client.version" to two different values
Date Sat, 10 May 2008 16:04:54 GMT
Hi John,

Does the project require Java 6? I checked out the sources and cd  
trunk; ant. It appears that one of the dependencies is compiled with  
Java 6.
     [javac] Compiling 29 source files to /Users/clr/spikes/trunk/bin
     [javac] /Users/clr/spikes/trunk/java/src/org/syger/fixtures/ cannot access org.parancoe.yaml.Yaml
     [javac] bad class file: /Users/clr/spikes/trunk/extlib/parancoe- 
     [javac] class file has wrong version 50.0, should be 49.0
     [javac] Please remove or make sure it appears in the correct  
subdirectory of the classpath.
     [javac] import org.parancoe.yaml.Yaml;
     [javac]                          ^
     [javac] 1 error

more below...

On May 10, 2008, at 7:38 AM, John Leach wrote:

> Dear list,
> As part of a (very) small open source project to provide domain entity
> mapping and association examples, together with a programmatic  
> interface to
> reach outside the JPA 1.0 specifications, I am struggling with two  
> problems
> using OpenJPA.
> I had better warn you all that I am a freelance consultant working  
> in Italy
> and I use and will be using this work to sell both the advantages and
> disadvantages (but with solutions) of using JPA 1.0. to my clients.
> The first showstopper is an InvalidStateException: Attempt to set  
> column
> "client.version" to two different values... where the version field  
> is being
> updated (this is an optimistic locking field, and has a @Version
> annotation), the SQL query being performed seems to be:
> UPDATE client SET lastUpdated = ?, version = ? WHERE id = ? AND  
> version = ?
> [params=(Timestamp) 2008-05-10 15:58:16.593, (int) 3, (long) 3,  
> (int) 2]

This SQL seems correct. It's updating the lastUpdated and version  
columns and verifying that the version is correct. Where does this  
error occur?

> The same annotated entities work just fine with Hibernate and  
> EclipseLink -
> for what that's worth.
> I have even tried adding openjpac in the ant task, but the results  
> remain
> the same.
> I am convinced that this is a Spring/OpenJPA configuration problem,  
> but
> being a relative novice with Spring (and OpenJPA) I have been  
> beating my
> head against the proverbial brick wall for two days, and not even a  
> dent in
> the wall to show for my efforts.
> The second showstopper is finding a way to change the metadata  
> before an
> EntityManager is created. The intention is to provide a 'third'  
> alternative
> to annotations and/or persistence.xml, where the entity classes  
> contain only
> JPA annotations, with any remaining changes being made  
> programmatically. The
> one-to-many example defines CascadeType.ALL, but actually requires a
> 'delete-orphans' extension for the tests to succeed. Again, my many  
> attempts
> at hooking into the properties openjpa.BrokerFactory or  
> openjpa.BrokerImpl
> or openjpa.MetaDataFactory all met with failure of one sort or the  
> other
> (mostly ClassCast exceptions within the OpenJPA code).
> Any help would be greatly appreciated. I am working 'in  
> collaboration with'
> two Java User Groups (Torino and Trento), but it's really me who  
> wrote most
> of the code.
> The open source project, called Spikes (guess why) can be downloaded  
> via
> Subversion with the command:
> svn checkout spikes
> There is a Trac site at 
> ,
> which I have converted to English in most places, and also an  
> article (which
> started the project rolling)
> Best regards
> John Leach, Verona, Italy
> -- 
> View this message in context:
> Sent from the OpenJPA Users mailing list archive at

Craig Russell
Architect, Sun Java Enterprise System
408 276-5638
P.S. A good JDO? O, Gasp!

View raw message