Feature Request: Optional versioning support in DAO

3 views
Skip to first unread message

fortuna

unread,
Feb 22, 2009, 8:48:49 PM2/22/09
to jcrom
Hi,

I don't think Google code supports feature requests in the issue
tracker yet, so I'm just posting here:

Currently if a node is versionable a DAO implementation will create a
new version each time the AbstractJcrDAO.update(T entity) method is
called.

Sometimes we don't want to create a new version, but rather just want
to update the current version. Would it be possible to add a new
method to support optional versioning - e.g. AbstractJcrDAO.update(T
entity, boolean newVersion)?

I think the current workaround is to not use the DAO for performing
updates on versionable nodes.

Also, I'd like to thank you for this library. It is really well
designed and a pleasure to use.

regards,
ben

Ólafur Gauti Guðmundsson

unread,
Feb 25, 2009, 6:14:23 AM2/25/09
to jcrom
Hi Ben,
Thanks for your kind words, glad you like the library.
Google code does support feature requests:

http://code.google.com/p/jcrom/issues/entry

Just change the "Type-Defect" label to "Type-Enhancement".

I'm not sure if what you are requesting is possible, but I'll have a
look!
Regards,
OGG

Ben Fortuna

unread,
Feb 25, 2009, 8:54:17 AM2/25/09
to jc...@googlegroups.com
Hmm, I may be going blind but I don't see a Type-Defect (see attached screenshot).

No problem if it isn't possible. I had a look at the source and I thought it might be possible to do something like this:

    protected String update( Node node, T entity, String childNodeFilter, int maxDepth, boolean newVersion ) {
        try {
            if ( isVersionable && newVersion) {
                //node.checkout();
                checkoutRecursively(node);
            }
            String name = jcrom.updateNode(node, entity, childNodeFilter, maxDepth);
            getSession().save();
            if ( isVersionable && newVersion) {
                //node.checkin();
                checkinRecursively(node);
            }
            return name;
        } catch ( RepositoryException e ) {
            throw new JcrMappingException("Could not update node", e);
        }
    }

I discovered that I don't actually need this feature yet anyway, as I can just update a node without updating it's children (i.e. dao.update(myEntity, "none", -1)), which is ok for now. I still think it might be something useful further down the track.

Again, thanks for the library, I've found it to be essential for working with JCR. :)

regards,
ben
--

Rodney Dangerfield  - "When I was a kid my parents moved a lot, but I always found them."
jcrom_new_issue.jpg

Ólafur Gauti Guðmundsson

unread,
Feb 25, 2009, 9:05:17 AM2/25/09
to jcrom
Right, it seems that only project members can edit the labels, sorry
about that!
Thanks for the code, I'll look into this before the next release.

Regards,
OGG
>  jcrom_new_issue.jpg
> 162KViewDownload
Reply all
Reply to author
Forward
0 new messages