myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Andraschko <zoi...@googlemail.com>
Subject Best practices for validating an complete object/entity
Date Wed, 16 Nov 2011 16:15:31 GMT
Hi,

i have some input fields for an entity and i want to check if the entered
name does already exist.
So i tried to create an BV constraint for the name property but i also need
the parent entity object (for checking if the entity is transient or not).
In a BV validator i can't get the the parent entity - so it's useless.
The other idea was to attach it on bean property level for the entity:

@UniqueName
private Entity entity.

<p:inputText value=#{bean.entity.name}" />

But this wont validate the entity.
I thought about an custom converter and binding the #{bean.entity}.
The problem is, in getAsObject i must load the entity by the name and the
bean.entity will be overwritten. Or not?

How can i prevent that the #{bean.entity} will be overwritten?
Is there another solution for validate the entity?

I also use CODI and ExtVal.

Thanks!

Best regards,
Thomas

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message