This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 143993 - Generate Data Validations in both JSF and Entity Beans
Summary: Generate Data Validations in both JSF and Entity Beans
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: JSF (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Matthew Bohm
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-14 23:09 UTC by asudhir
Modified: 2016-07-07 08:54 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description asudhir 2008-08-14 23:09:19 UTC
When using JPA with hibernate, in Entity Beans we can define data validations using annotations as follows,

import org.hibernate.validator.Email;
import org.hibernate.validator.Length;

@Length(min=2, max=25, message="not a valid mail")
@Email

Atleast when user selected Hibernate, it will be good if Entity Beans generated can generate some default validations
for data variables. It will help users in quickly updating these as required and have very good code.

Similarly in JSF pages we can provide validations for each of the variables as follows,

<h:inputText value = "#{UserBean.userName}" id = "userNameTextField" required="true">
    <f:validateLength minimum = "10" maximum = "15"/>
</h:inputText>

Likewise when generating JSF pages from Entity beans, if it can refer back to Entity beans and generate validations that
will be helpful. If not available, if it can generate some default values for validations, that's also very helpful.

Change Suggested : During the code generation process, check with user if default data validations need to generated.
Comment 1 asudhir 2008-08-26 22:12:14 UTC
When using Hibernate Validator, having additional validation in JSF files could be duplicate. For example in this post,

http://wiki.netbeans.org/UsingHibernateWithJPA%5C

under section "Adding validation".

It would be required to only generate validations using annotations in DAO beans.

and call validate(..) method backing bean when user does edit or update operations.

This will help not having to duplicate validations in 2 places.
Comment 2 Martin Balin 2016-07-07 08:54:38 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss