-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate Validator in contextual/stateful updates/inserts
PostPosted: Mon May 01, 2006 8:40 pm 
Beginner
Beginner

Joined: Wed Apr 26, 2006 2:41 pm
Posts: 30
I have been using the hibernate.validator framework a bit and like what I see so far. I am wondering what people are doing to express stateful validations. As Martin Fowler writes, "Often when people talk about a context-free validity, they mean it in terms of saving to a database." In this case, I think the validator package was designed for exactly this context but starts to offer usefulness in other contexts.

As an example of thinks I'm not sure I can express in validations yet:

* dirty checking, i.e. updates to certain columns should fail (not just be excluded from the statement)
* updates or inserts are only valid dependant on a sql query.
* although selects are filterable, is it possible to declaratively state that updates are not allowed when given a user?

It looks like the options we have are:

* give enough information to the domain POJO and express it there.
* write your own validation, add it to the event based code and call it manually using the Application level validator.
* express state using other annotations and use those to determine context (like Seam I guess)
* something else that I'm not aware of yet?

I dont really want my domain level POJO's to be mucking around with EntiyManagers or Sessions. I saw that emmanuel was not against passing in stateful information in theory somewhere on this board (sorry i cant find the post). Is there a way to do dirty field checking inside a validator? Otherwise it would be nice to have an @AssertTrueOnInsert, and @AssertTrueOnUpdate.

Just wondering what other people are doing here...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.