Cloning detachable PC objects in Kodo 3.0

If a detachable PC object is also Cloneable, will Kodo JDO enhance the
clone() method to copy the detached-objectid-field and detached-state-field,
if those fields are not declared explicitly?
Or should Cloneable objects always explicitly declare their own
detached-objectid-field and detached-state-field, and copy their values
explicitly? The detached-state-field is an Object, but is it Cloneable, or
should it be copied by serializing and then deserializing?
Ben

If a detachable PC object is also Cloneable, will Kodo JDO enhance the
clone() method to copy the detached-objectid-field and
detached-state-field, if those fields are not declared explicitly?Kodo will not change the clone method. If you are concerned about these
fields, you should explicitly declare the fields and your own clone
method to copy them.
The detached-state-field is an Object, but is it Cloneable,
or should it be copied by serializing and then deserializing?I believe it is safe to assume the detached state field Object will not
be changed. Therefore, simply assigning the clone's reference to the
same Object should be sufficient.
Note that these fields are only used when a previously-managed object is
detached and then reattached. So you only have to worry about cloning
these fields if you plan on detaching a managed object, cloning it, and
then reattaching the clone.

Similar Messages

  • Deep Cloning of resultset object

    Hi, Is it possinble? Deep Cloning of resultset object?
    Resltset rs = pstmt.execute()
    Anyway to assign rs2 = rs1
    Because I am passing my resulset to a legacy application's method, that does a rs.close(). I need to use the same resultset later. JDK 1.4

    Write a dynamic proxy to the ResultSet where theclose() method does >nothing.
    What if the OP discovers that the app does a rs=null
    as well?How can that affect your code? Presumably the ResultSet is passed as an argument to a legacy method so the legacy method might set it's local reference to null it will not affect the reference held by the caller of the method.
    The op then runs thru hoops to get permission to
    modify a line in legacy code and is too distressed to
    post.He does not need to! You need to learn about Java argument passing.
    Anyway, thanks for the classrom solution. but i cant
    create another class file for extending rs.You have not presented any reason why not! This can be an inner class in the code you are writing and has no influence what so ever on the legacy application.
    >
    If you are too distressed by the posts here, you are
    under no obligation to reply to every one. Anyway , i
    found the postI replied because I had a viable solution to a problem you were having. Nothing you have said so far stops it being viable. Look at my posting history - I do not try to reply to everyone.
    >
    A Resultset is mainly a Java front end for adatabase
    cursor (which exists on the database server). When
    the ResultSet is closed, the cursor will be closed
    too so, even if you could copy everything in the
    ResultSet object, the handle for the cursor wouldno
    longer be valid.
    Which is why you use a Proxy so that you can control exactly what happens.
    >>
    To truely "deep copy" a resultset the depth would
    have to extend accros the database connection to
    cloning the cursor.I still don't see why you need to clone the ResultSet rather than use a proxy!
    >
    very much useful than the self pity expressed by
    you.No self pity! I just expressed annoyance at the lack of feedback from you and many others.
    No offence, none taken and none dealt.I still find it offensive when people don't bother with a simple acknowledgement. I don't ask many questions myself but when I do I make sure I track the responses and acknowledge those who try to help.
    I still think you should re-think your solution but you are free to totally ignore my very simple solution. I expect you will ignore it so the best of luck.

  • Removing object from kodo datacache doesnt always work.

    Hi,
    We're using a very old version of kodo - 3.4.1 but it seems to work well.
    We seem to have come across an intermittent issue where if we remove an object from the datacache using the DataCache.commit call, then the object doesnt actually seem to get removed. So the application continues operation with the out of date cached object. We get no exception or error though.
    Has anyone see anything like this before? I can't seem to find any available known issues list or bug database for kodo, I guess this isnt available?
    Thanks,
    Dan

    The size will refer to individual DataCache size.
    KodoPersistenceManager.getDataStoreCache() or getDataStoreCache("myCache") will return the default or named datacaches respectively.
    You can evict the L2 cache content on the returned DataCache instance from the previous methods.

  • Cloning the class object

    Hi
    I have a class which looks something like this:
    class A
    String name = null ;
    int age = 0 ;
    Object a = null
    Object b = null ;
    The Object classes could be any types including Dates etc but it is not fixed and so I am using object. The problem is that I also want to copy this class. Now I am writing my own constrcutor to make a copy object but there is no clone() method available for object. The api shows one but it doesn't work.
    Any idea what the problem is or how I may copy a raw object?
    Cheers

    go through this example
    Cloning an Object
    class CloneClass implements Cloneable
    public CloneClass()
    public Object clone()
    Cloneable theClone = new CloneClass();
    return theClone;
    public String toString()
    return "Hello";
    public static void main(String[] args)
    CloneClass myObject = new CloneClass();
    System.out.println("MyOjbect: "+myObject);
    CloneClass myObjectClone = (CloneClass)myObject.clone();
    System.out.println("MyObjectCloned: "+myObject);
    //Arrays are automatically cloneable:
    int[] ints = new int[]{123, 234};
    System.out.printf("%s\n","Array Before Clone ...");
    for(int i:ints)
    System.out.printf("%d,\n",i);
    int[] intsClone = (int[])ints.clone();
    System.out.printf("%s\n","Array After Clone ...");
    for(int i:intsClone)
    System.out.printf("%d,\n",i);
    }

  • Pooling of objects by Kodo

    Does Kodo pool the JDO objects it creates?. and if so, is that pool
    configurable?. I might have a lot of objects of one persistent type to be
    lying around, but not for some others.
    TIA, -Subhash.

    "perl hash" <[email protected]> writes:
    Does Kodo pool the JDO objects it creates?. and if so, is that pool
    configurable?. I might have a lot of objects of one persistent type to be
    lying around, but not for some others.
    TIA, -Subhash.Currently, Kodo JDO only performs caching as required by the
    specification. A beta version of more sophisticated caching is now
    available (see post on the beta newsgroup), and will be available in a
    future release. The current beta stores soft references to cached data.
    We are planning on including a configurable hard reference size.
    Additionally, we will likely release a cache policy API so that you can
    fully customize the caching policies.
    -Patrick
    Patrick Linskey [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • Updating Transient objects in Kodo 2.5.5

    I have a situation where I construct a JDO object in transient state in my
    code ( for batch processing of data from a file into the database) by
    calling the objects contructor and setting it's values. The row
    representing this object may or may not exist in the database.
    How do I make the object peristant ? If the row already exists, then I
    must be able to update the row with the new values ( non-primary keys ).
    If not, I should insert a new row.
    There are no multi table relationships involved in this case. A JDO object
    represents just one table.
    We want to avoid the scheme which involves retrieve the object first and
    then trying to update in a transaction.
    Adarsh

    Transaction t = kpm.currentTransaction();
    try {
    MyObject o = new MyObject(...)
    t.begin();
    Object id = ((PersistenceCapable)o).jdoNewObjectIdInstance();
    ((PersistenceCapable)o).jdoCopyKeyFieldsToObjectId(id);
    try{
    System.out.println(id);
    Object trio = pm.getObjectById(id,true);
    pm.deletePersistent(trio);
    }catch(ObjectNotFoundException oe){
    System.out.println("First time!");
    pm.makePersistent(o);
    t.commit();
    }catch(...){

  • Not able to link the cloned business object in change document

    Hi Experts,
    I cloned standard business object FIPP.  When I give the cloned busniess object in change document linkage, I am getting the error message Business object type ZFI_CREDIT has status modeled. Linkage not possible. Please let me know the proceedue to make the linkage.
    Thanks in advance.
    Regards,
    Viven

    In SWO1 you have a possibility to change the status of your custom business object into implemented.

  • Returning cloned objects from EJB Local Interfaces

    We'd like to let our WAS 5/J2EE container manage our transactions/unit of work. However, we don't want to have our objects serialized, so we intend to use LocalInterfaces. Additionally, we want to return value objects that support Toplink indirection such that we are not returning the actual cache object but instead a clone.Our question is, how do we return a cloned object that supports indirection from Toplink that we can later do a deepMergeClone on in an explicit update method?

    Additional Information on the first post:
    The pattern we've been testing is as follows:
    1. We set up LocalInterfaces on our EJB's
    2. The EJB Getters are using acquireNonSynchronizedUnitOfWork() to get a NON-JTS transaction to perform a readQuery. This results in a Cloned Bis object being generated. We then release the UOW and return the object.
    3. The Returned Biz object Getters are using Indirection (probably using the released non-synchronized UOW).
    4. The pattern for UPDATE is that we allow the Web Container code (servlet) to change the Cloned Biz Object, they then submit the CLONED and changed object to an EJB update() method where we use getClientSession().getActiveUnitOfWork() to link to the JTS transaction and perform a uow.deepMergeClone(bizObjectClone);
    We are trying to use the pattern for the following reasons:
    1. Isolation of the Cache to upper layers
    2. Transaction Boundry is the EJB Container
    3. We understand that there is a performance overhead with CLoned Biz Objects but this more mirrors the ValueObject Pattern then anything else we've tried.
    BIG Question:
    1. Is this a supported TopLink Pattern?
    2. If its not supported, can it be?
    3. Do you have any other suggested patterns?

  • Adding object to collection outside of unit of work?

    Hi,
    Tried to find the answer in this forum but difficult to know what keywords to use...anyway
    What I am trying to do is so simple I can only believe I am missing the point somewhat ;-)
    I have an object Licence that has a Set of LicenceHolders. I have a licence already saved in the db and the application now has cause to add a licenceHolder. I create the licenceHolder as a new object then get the licence out of the db, add the licenceHolder to the Set, then I make a call to my data persistance business class to make the save to the database. I.e. I have a separate layer to do the persistance from my business logic. The latter being the specific method to say 'add a licence holder to the licence', the former being 'save the licenceHolder, and update the link table between the licence and licenceHolder' (m - m relationship).
    The problem I have is that in my business method licence.addLicencee(licenceHolder) doesn't save my licenceHolder and link table if I don't include the bold line below. This does work but see below for more comments
    code snippet for business method....
    // lm is the persistance method that gets licence from db
    PremisesLicence licence = (PremisesLicence) lm.getLicence(premisesLicenceId);
    // licenceePerson - new object not yet persisted
    licence.addLicenceHolder(licenceePerson);     
    //lhm is another persistance method to save licenceePerson and update licence_licenceHolder link table
    lhm.addLicenceHolder(licenceePerson, licence);
    code for lhm...
    public void addLicenceHolder(ILicenceHolder licenceHolder, Licence licence) throws DataAccessException {
    UnitOfWork uow = aSession.acquireUnitOfWork();
    try {
         Licence licenceClone = (Licence) uow.readObject(licence);
    licenceClone.addLicenceHolder(licenceHolder);
         uow.registerNewObject(licenceHolder);
         uow.commit();
    } catch (Exception e) {
         e.printStackTrace();
         throw new DataAccessException(e);
    I don't believe I should have to do the bold line as it is business logic in the persistance logic. I have already (in business method) said 'this licence has this licenceHolder' why should I have to repeat it in the persistance layer too. This can only lead to bugs in my software - I need all the help I can not to introduce any more ;-)
    Comments please?
    Thanks
    Conrad

    We've been working with TopLink for a while now, and had some issues with what you are doing. The following way is how we interact with TopLink to enable modifications outside the UoW:
    - When returning objects from you DAO layer always return a copy of the retrieved objects (try Session.copyObject()), not the object returned by TopLink.
    - Do modifications to the copied objects
    - Pass the modified object graph to the DAO layer and use uow.mergeCloneWithReferences() to merge in differences
    - Save to database with TopLink
    From our experience, the reason you have to copy things is because what TopLink returns is the cached objects. So because you then will modify the cached objects, TopLink will not discover changes (comparing an object to itself will not give any differences). At least that was the only explanation we could find to our strange behaviour.
    This is not a very efficient way to do things, and I think that if you are able to have a UoW open during this whole process it would be much more efficient. For an easy way to do this with web applications check out the TopLink integration with Springframework.
    Please let me know if anyone has any feedback to this way of doing it. I know it's not ideal, but it is the best solution we found for detaching the objects.

  • Vector clone references the same objects??

    Hi all
    I'm developing a simple chess program.
    Obviously, each move the user tries must be checked against the following sets of chess rules:
    1.) Whether it is that colour player's turn to move
    2.) Whether this move is valid for this specific piece (eg. 3 forward for a King --> invalid of course)
    3.) Whether this move will jeopardize the player's king (put it in check)
    If from any of the above the move is found to be invalid, the move is not executed.
    My program structure is briefly this:
    A. abstract super class 'ChessPiece' - subclassed by the various specific Chess Piece classes.
    Each of the specific ChessPiece subclasses must implement an abstract method to check if a
    proposed move is valid, and also a method to actually do the move...
    B. 'PieceManager' class - has a Vector of ChessPieces:
    This class checks whether the given move is valid:
    For the piece: by calling the checking method (see A above)
    For the general game: by making sure the given move doesn't put the player's king in check.
    NOTE: In chess (for those who don't know), it is illegal to move any piece if, at the end of
    the move, your king will be in check [possible to be captured by any enemy piece]
    This last check I want to do in the following way:
    1) copy/clone the entire PieceManager object
    2) in this copied object, actually do the move
    3) still in the copied/cloned object, see if the moving player's king is now in check
    4) based on this evaluation, execute the move in the original PieceManger object or don't...
    The Problem:
    When I clone this PieceManager object, its 'pieces' Vector is obviously also cloned.
    BUT it seems that the cloned 'pieces' Vector references the same ChessPiece objects
    as those referenced by the original 'pieces' Vector; ie the 2 Vectors are sharing the same Objects.
    Thus, when I actually execute the move in the test/cloned PieceManager object,
    the original PieceManager's corresponding piece is moved too (well, it seems it is the same piece...).
    I am pretty stuck with this.
    I've tried the Vector clone method; it doesn't seem to copy the objects, but create another reference
    to the same objects, as I've said.
    I've tried cloning the entire object ; also not helping......
    I'd love any comments, helpful pointers, suggestions.
    Also any comments on my program structure... is a Vector the best tool for this job?
    Thanks very much -
    lutha

    Hi all, OP here.
    Ok thanks guys for all your posts...
    two points:
    1) I have tried the "copy constructor", and it seems to be doing the same thing. (ie 'shallow clone')
    What's really frustrating me is that nothing I do seems to actually physically copy the Vector's objects
    to new, separate copies of those objects...
    I had my PieceManager class implement Cloneable (just in case - not too sure on that one; in fact I
    commented that out later), and I overrode the clone method like this:
    public Object clone ()
            PieceManager pm = new PieceManager ();
            Vector pcs = new Vector ();
            // Enumeration e = pieces.elements ();
            //while (e.hasMoreElements ())
            //    ChessPiece p = (ChessPiece) e.nextElement ();
            //pcs.add ();
            //}  // still references the same objects!!
            pieces.trimToSize ();
            int size = pieces.size ();
            Object[] arr = new Object [size];
            Object[] initial = pieces.toArray ();
            System.arraycopy (initial, 0, arr, 0, size);
            for (int i = 0 ; i < size ; i++)
                ChessPiece p = (ChessPiece) arr ;
    pcs.add (p);
    pm.pieces = pcs;
    return pm;
    This all still does the same 'shallow cloning'...
    2) m.winter, my ChessPiece objects are not immutable - they have a co-ordinate field that
    changes as they are moved. This is for getting as called by another object, and for checking in
    the ChessPiece's own internal method for checking whether the passed-in square co-ordinate
    is a valid destination.
    Anyway, I don't think that's the main issue here. How can I properly clone/copy a Vector, resulting
    in :
    a) the original Vector
    b) a new, totally unrelated Vector.
    Thanks again all for your input.
    regards,
    lutha

  • Deep Cloning of Arrays

    Hello, I am stuck with this problem...
    I am trying to clone an Array object of type MajorCat. Each MajorCat contains another Array of type MinorCat.
    MajorCat[] contains n MajorCat
    MajorCat[0] contains MinorCat[], of length m
    I wanna clone MajorCat[], which will in turn clone MinorCat[] embedded within it.
    Tried the method given in Section "CloneDemo5" within:
    http://developer.java.sun.com/developer/JDCTechTips/2001/tt0306.html
    The result is strange, and I need a solution...
    Result:
    1) MajorCat[] after cloning gives another copy
    2) MinorCat[] after cloning gives another copy
    3) the orginal MajorCat[] remains the same Object
    4) BUT THE ORIGINAL MinorCat[] points to the Object at 2) !!!!!!!
    Please see this System.out:
    Original MAJORCAT starting off is [LMajorCat;@59ac7b [LMinorCat;@e2ae8   <--- 1)
    Minor Cat before cloning: [LMinorCat;@e2ae8
    Minor Cat after cloning:  [LMinorCat;@489bb6
    New MAJORCAT afterward is  [LMajorCat;@487a3a [LMinorCat;@489bb6
    Original MAJORCAT is   [LMajorCat;@59ac7b [LMinorCat;@489bb6
    Here is the code:
    MajorCat[] tempcat = (MajorCat[])(majorcat.clone());
    for ( int i=0; i<majorcat.length; i++ ) {
    if ( majorcat.minorcat != null ) {
    tempcat.minorcat = (MinorCat[])(majorcat.minorcat.clone());
    What have I done wrong? A million thanks in advance!!!!

    Hello, I put the overloading clone() method back into MajorCat and MinorCat. Again, they are never called...
    Here is the code:
    public class CatelogueSingleton extends ConnectionBase {
        protected MajorCat[] majorcat = null;
        public MajorCat[] getCatelogue() {
            if ( majorcat == null ) {
                renewAllObjects();
                System.out.println("majorcat erased!");
            MajorCat[] tempcat = (MajorCat[])(majorcat.clone());
            System.out.println("original object is   " + majorcat + " " + majorcat[0].minorcat + " " + majorcat[0].minorcat[0].itemgroup + " " + majorcat[0].minorcat[0].itemgroup[0].item);
    // clone each Object in majorcat[]
            for ( int i=0; i<majorcat.length; i++ ) {
                if ( majorcat.minorcat != null ) {
    tempcat[i].minorcat = (MinorCat[])(majorcat[i].minorcat.clone());
    for ( int j=0; j<majorcat[i].minorcat.length; j++ ) {
    if ( majorcat[i].minorcat[j].itemgroup != null ) {
    tempcat[i].minorcat[j].itemgroup = (ItemGroup[])(majorcat[i].minorcat[j].itemgroup.clone());
    for ( int k=0; k<majorcat[i].minorcat[j].itemgroup.length; k++ ) {
    if ( majorcat[i].minorcat[j].itemgroup[k].item != null ) {
    tempcat[i].minorcat[j].itemgroup[k].item = (Item[])(majorcat[i].minorcat[j].itemgroup[k].item.clone());
    System.out.println("cloned object is " + tempcat + " " + tempcat[0].minorcat);
    System.out.println("after cloning the original object is " + majorcat + " " + majorcat[0].minorcat);
    return tempcat;
    Here is the code for MajorCat...
    public class MajorCat extends ConnectionBase implements java.io.Serializable, Cloneable {
        public MinorCat[] minorcat = null;
        public Object clone() {
            try {
                System.out.println("Cloning majorcat");
                MajorCat aobj = (MajorCat)super.clone();
                aobj.minorcat = (MinorCat[])(this.minorcat.clone());
                return aobj;
            catch (CloneNotSupportedException e) {
                throw new InternalError(e.toString());
        public MajorCat() {
    }here is the code for MinorCat...
    public class MinorCat extends ConnectionBase  implements java.io.Serializable, Cloneable {
        public ItemGroup[] itemgroup = null;
        public Object clone() {
            try {
                MinorCat aobj = (MinorCat)super.clone();
                aobj.itemgroup = (ItemGroup[])(this.itemgroup.clone());
                return aobj;
            catch (CloneNotSupportedException e) {
                throw new InternalError(e.toString());
        public MinorCat() {
    }The result is:
    original object is [LMajorCat;@572085 [LMinorCat;@180b94
    cloned object is     [LMajorCat;@148656 [LMinorCat;@180b94
    after cloning the original object is  [LMajorCat;@572085 [LMinorCat;@180b94
    The original MinorCat within MajorCat now points to the new clone, and the clone() within MajorCat and MinorCat aren't called.... as there is no System.out statements.
    What have I done wrong in clone() within MajorCat and MinorCat?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Qualifing to be an immutible object

    Question: Is it possible to design an immutable object having final object references to mutable objects and still be 'viewed' as immutable.
    From the book JAVA Concurrency in Practice by Brian Goetz the following statements are made (that have confused me a bit):
    "Immutable objects ... can be safely accessed even when synchronization is not used to publish the object reference." (p.51)
    "... if [an object's] final fields refer to mutable objects, synchronization is still required to access the state of the objects they refer to."(p.52) To me this states that this type of object is not considered immutable.
    However, notice the final array object references to BigInteger[] from an example on page 49:
    @Immutable
    class OneValueCache {
        private final BigInteger lastNumber;
        private final BigInteger[] lastFactors;
        public OneValueCache( BigInteger i, BigInteger[] factors ) {
            lastNumber = i;
            lastFactors = Array.copyOf( factors, factors.length );
        public BigInteger[] getFactors( BigInteger i ) {
            if ( lastNumber == null || !lastNumber.equals( i ))
                return null;
            else
                return Arrays.copyOf( lastFactors, lastFactors.length );
    } Can all of the bigInteger[] lastFactors be considered final since the array object reference is final? Or is the immutability allowed since lastFactors is isolated with Arrays.copyOf() in both the constructor and getFactors() function? Does isolation of mutable objects references using techniques such as object cloning allow the object design to be immutable?
    Edited by: rbroersma on May 18, 2010 10:37 PM

    ejp wrote:
    So if the Object doesn't exist until the constructor returns what is the constructor is working on? Bringing the object into existence.He means, what is the constructor operating on or +manipulating, i.e. what is "this" referring to at that point?  Because you can pass "this" to other methods as if it existed.  And they can operate on it as if it existed...  So if you can do all those things to an object that doesn't exist, what good is your definition of existence?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Kodo.util.UnsupportedException: null

    Hello,
    Now I'm getting further. I was able to persist my objects!
    However, I have an error regarding NamedQuery.
    Here is the error:
    Exception in thread "main" <3|true|4.0.0EA3>
    kodo.util.UnsupportedException: null
         at
    kodo.query.ExpressionStoreQuery.executeUpdate(ExpressionStoreQuery.java:232)
         at
    kodo.query.ExpressionStoreQuery$DataStoreExecutor.executeUpdate(ExpressionStoreQuery.java:588)
         at
    kodo.query.ExpressionStoreQuery$DataStoreExecutor.executeUpdate(ExpressionStoreQuery.java:598)
         at kodo.query.QueryImpl.update(QueryImpl.java:1223)
         at kodo.query.QueryImpl.execute(QueryImpl.java:950)
         at kodo.query.QueryImpl.updateAll(QueryImpl.java:1005)
         at kodo.query.DelegatingQuery.updateAll(DelegatingQuery.java:812)
         at kodo.persistence.QueryImpl.executeUpdate(QueryImpl.java:300)
         at com.dalitest.ClientsDAO.updateClient(ClientsDAO.java:35)
    The error is cryptic as well.
    It happens for this code:
    public int updateClient(EntityManager em, Client c)
    Query q = em.createNamedQuery("UpdateClient");
    //q.setParameter("newName", c.getName());
    q.setParameter("cId", c.getId());
    return q.executeUpdate();
    And for my Client class I have (snipped):
    @NamedQueries( {
    @NamedQuery(name = "UpdateClient", queryString = "UPDATE Client c SET
    c.name=:newName WHERE c.id=:cId"),
    @NamedQuery(name = "DeleteClient", queryString = "DELETE from Client c
    WHERE c.id=:cId") })
    @Entity(access = AccessType.PROPERTY)
    @Table(name = "DALI_CLIENTS")
    public class Client {...}
    In case I do uncomment q.setParameter("newName", c.getName());
    The following exception is thrown:
    Exception in thread "main" <4|false|4.0.0EA3>
    kodo.persistence.ArgumentException: More parameters were passed to
    execute() than were declared: {1} parameters were specific for query
    execution, but only {0} parameters were declared in the query.
         at kodo.query.QueryImpl.assertParameters(QueryImpl.java:1871)
         at kodo.query.QueryImpl.execute(QueryImpl.java:941)
         at kodo.query.QueryImpl.updateAll(QueryImpl.java:1005)
         at kodo.query.DelegatingQuery.updateAll(DelegatingQuery.java:812)
         at kodo.persistence.QueryImpl.executeUpdate(QueryImpl.java:300)
         at com.dalitest.ClientsDAO.updateClient(ClientsDAO.java:35)
    Can anyone point me what is wrong with my update query?

    Abe White wrote:
    Thanks Abe for the information.
    How do I have to proceed then with my updates at the moment? Do you have
    any suggestions (besides waiting for the next release)?
    Update the objects individually, or use SQL. Kodo allows you to access
    the JDBC connection:>
    http://solarmetric.com/Software/Documentation/4.0.0EA/docs/full/html/ref_guide_dbsetup_sqlconn.html
    Thanks for the suggestions. SQL is not an option, since it will defeat the
    purpose of the EJB3-persistence.
    But can you elaborate more on the "Update the objects individually"
    approach.
    Let's say I have persistent Java bean Client and I changed some of its
    properties (e.g. myClient.setName("New Name");)
    How do I persiste it "individually"?
    This approach does not work:
    EntityTransaction t = em.getTransaction();
    t.begin();
    List<Client> pClients = new ClientsDAO().getAllClients(em);
    for (Client pClient : pClients)
    pClient.setName("New Name");
    em.persist(pClient);
    t.commit();
    It throws error on t.commit();
    <2|false|4.0.0EA3> kodo.util.OptimisticException: An optimistic lock violation
    was detected when flushing object instance
    "kodo.synthetic.com.dalitest.ClientKodoSyntheticSubclass-id-3" to the data
    store. This indicates that the object was concurrently modified in another
    transaction.
    FailedObject: kodo.synthetic.com.dalitest.ClientKodoSyntheticSubclass-id-3
         at
    kodo.jdbc.kernel.PreparedStatementManager.checkUpdate(PreparedStatementManager.java:358)
         at
    kodo.jdbc.kernel.PreparedStatementManager.executeBatch(PreparedStatementManager.java:291)
         at
    kodo.jdbc.kernel.PreparedStatementManager.flushInternal(PreparedStatementManager.java:243)
         at
    kodo.jdbc.kernel.PreparedStatementManager.flush(PreparedStatementManager.java:206)
         at kodo.jdbc.kernel.UpdateManagerImpl.flush(UpdateManagerImpl.java:217)
         at kodo.jdbc.kernel.UpdateManagerImpl.flush(UpdateManagerImpl.java:94)
         at kodo.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:557)
         at
    kodo.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:151)
         at kodo.kernel.BrokerImpl.flush(BrokerImpl.java:2034)
         at kodo.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1893)
         at kodo.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1819)
         at kodo.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:67)
         at kodo.kernel.BrokerImpl.commit(BrokerImpl.java:1426)
         at kodo.kernel.DelegatingBroker.commit(DelegatingBroker.java:1145)
         at kodo.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:420)
         at com.dalitest.Test.main(Test.java:55)

  • Collection of non-persistent objects

    Greetings
    Is it possible to persist a Collection of non-persistent objects through the
    kodo externalization feature? The non-persistent objects themselves are
    externalizable, but I don't know how I would go about persisting a
    Collection of them.
    ..droo.

    If you store them in some sort of externalized form in a single column it is
    easy - just use externalization framework to ext and de-ext them to anf from
    string. Couple of caveats you need to be aware of If your collection objects
    are mutable:
    1. You need to durty your collection field so it get prsisted on commit
    2. on rollback Kodo will restore you collection content but not collection
    member content. If they are mutable you will have to make their class
    persistent with mapping "none" so they participate in transaction
    "Drew Lethbridge" <[email protected]> wrote in message
    news:BD0B44BF.544%[email protected]..
    Greetings
    Is it possible to persist a Collection of non-persistent objects throughthe
    kodo externalization feature? The non-persistent objects themselves are
    externalizable, but I don't know how I would go about persisting a
    Collection of them.
    .droo.

  • SDO and Kodo

    While using SDO's (Service Data Objects) with kodo I get the following stack trace
    2013 TRACE [main] kodo.jdbc.SQL - <t 20971840, conn 247336638> SHUTDOWN
    Exception in thread "main" <3|true|4.0.0EA4> kodo.util.UnsupportedException: Una
    ble to create second class object proxy for type: "interface org.eclipse.emf.com
    mon.util.EList".
    at kodo.util.ProxyManagerImpl.findProxy(ProxyManagerImpl.java:243)
    at kodo.util.ProxyManagerImpl.newCollectionProxy (ProxyManagerImpl.java:1
    97)
    at kodo.kernel.StateManagerImpl.newFieldProxy(StateManagerImpl.java:1775
    at kodo.kernel.StateManagerImpl.newProxy(StateManagerImpl.java:1737)
    at kodo.jdbc.meta.strats.StoreCollectionFieldStrategy.load (StoreCollecti
    onFieldStrategy.java:507)
    at kodo.jdbc.meta.FieldMapping.load(FieldMapping.java:938)
    at kodo.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:514)
    at kodo.kernel.DelegatingStoreManager.load (DelegatingStoreManager.java:1
    30)
    at kodo.kernel.ROPStoreManager.load(ROPStoreManager.java:78)
    at kodo.kernel.StateManagerImpl.loadFields(StateManagerImpl.java:3296)
    at kodo.kernel.StateManagerImpl.loadField (StateManagerImpl.java:3396)
    at kodo.kernel.StateManagerImpl.accessingField(StateManagerImpl.java:155
    3)
    at com.ibm.websphere.fvt.ejbquery.emf.impl.DeptMedImpl.kodoGetemps(DeptM
    edImpl.java)
    at com.ibm.websphere.fvt.ejbquery.emf.impl.DeptMedImpl.getEmps(DeptMedIm
    pl.java:329)
    at com.ibm.websphere.fvt.ejbquery.emf.impl.DeptMedImpl.eInverseAdd(DeptM
    edImpl.java:350)
    at com.ibm.websphere.fvt.ejbquery.emf.impl.EmpMedImpl.setDept (EmpMedImpl
    .java:354)
    at com.ibm.websphere.fvt.ejbquery.emf.impl.AnimalMaintenance.updateEmp(A
    nimalMaintenance.java:285)
    at com.ibm.websphere.fvt.ejbquery.emf.impl.AnimalMaintenance.main(Animal
    Maintenance.java:349)
    So basically in EJB3 environment how do I make kodo aware of the new Type Elist.Reading the document it appears that
    u define valueHandlers for new types.But how do u write a value handler for a List. Any examples?

    You need to use have a custom proxy manager so that Kodo can understand
    what changes are occuring in third party collections:
    http://solarmetric.com/Software/Documentation/4.0.0EA5/docs/ejb/html/ref_guide_conf_kodo.html#kodo.ProxyManager
    Ritika Maheshwari wrote:
    While using SDO's (Service Data Objects) with kodo I get the following stack trace
    2013 TRACE [main] kodo.jdbc.SQL - <t 20971840, conn 247336638> SHUTDOWN
    Exception in thread "main" <3|true|4.0.0EA4> kodo.util.UnsupportedException: Una
    ble to create second class object proxy for type: "interface org.eclipse.emf.com
    mon.util.EList".
    at kodo.util.ProxyManagerImpl.findProxy(ProxyManagerImpl.java:243)
    at kodo.util.ProxyManagerImpl.newCollectionProxy (ProxyManagerImpl.java:1
    97)
    at kodo.kernel.StateManagerImpl.newFieldProxy(StateManagerImpl.java:1775
    at kodo.kernel.StateManagerImpl.newProxy(StateManagerImpl.java:1737)
    at kodo.jdbc.meta.strats.StoreCollectionFieldStrategy.load (StoreCollecti
    onFieldStrategy.java:507)
    at kodo.jdbc.meta.FieldMapping.load(FieldMapping.java:938)
    at kodo.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:514)
    at kodo.kernel.DelegatingStoreManager.load (DelegatingStoreManager.java:1
    30)
    at kodo.kernel.ROPStoreManager.load(ROPStoreManager.java:78)
    at kodo.kernel.StateManagerImpl.loadFields(StateManagerImpl.java:3296)
    at kodo.kernel.StateManagerImpl.loadField (StateManagerImpl.java:3396)
    at kodo.kernel.StateManagerImpl.accessingField(StateManagerImpl.java:155
    3)
    at com.ibm.websphere.fvt.ejbquery.emf.impl.DeptMedImpl.kodoGetemps(DeptM
    edImpl.java)
    at com.ibm.websphere.fvt.ejbquery.emf.impl.DeptMedImpl.getEmps(DeptMedIm
    pl.java:329)
    at com.ibm.websphere.fvt.ejbquery.emf.impl.DeptMedImpl.eInverseAdd(DeptM
    edImpl.java:350)
    at com.ibm.websphere.fvt.ejbquery.emf.impl.EmpMedImpl.setDept (EmpMedImpl
    .java:354)
    at com.ibm.websphere.fvt.ejbquery.emf.impl.AnimalMaintenance.updateEmp(A
    nimalMaintenance.java:285)
    at com.ibm.websphere.fvt.ejbquery.emf.impl.AnimalMaintenance.main(Animal
    Maintenance.java:349)
    So basically in EJB3 environment how do I make kodo aware of the new Type Elist.Reading the document it appears that
    u define valueHandlers for new types.But how do u write a value handler for a List. Any examples?

Maybe you are looking for

  • Error running new report in Siebel

    Hi All, I get this error when trying to run a new report in Siebel (on local web client): We detected an Error which may have occurred for one or more of the following reasons: BI Publisher engine failed to generate report.(SBL-RPT-50524) I have regi

  • WiFi & Data Plans

    Hi. First of all I bought an unlocked AT&T Blackberry Torch on eBay. Since I'm a low volume user I'm using H2O Pre-Paid $29.99/month plan where the data rate is too high. I need to make sure my phone will never try to connect to the internet via the

  • Launching another VM instance using Runtime.exec()

    Hi, I have two separate Swing applications, say A and B. I need to launch B from A using Runtime.exec() - essentially I am launching another VM instance from one VM. I am encountering strange problems - B's main window comes up, but GUI doesn't updat

  • Select-options as subscreen

    Hi! I have created a selection screen as subscreen inside a container. Now i want to change one of the select-options to invisible. ¿Where i have to put the loop at screen.- endloop code?. When i put it in the main window it doesn´t read the fields o

  • OID questions

    Hi, We are in the process of replacing TNSNAMES.ORA with OID (ver 9.2.0) , a couple of things that I am wondering about is: 1. Is there some way to log the activities in OID?, i.e. where you can get the information: "I have been contected for name re