While trying to submit a new record with blankOption="always" and
t:secure="literal:NEVER" I'm finding when my getModel method is
called, the query used to rebuild my select model attempts to commit
my object model to the database resulting in a database constraint
violation exception rather than throw back a validation error.
See code
<t:Select t:id="serviceType" value="companyContract.supportContract"
model="supportContractModel" t:secure="literal:NEVER"
blankOption="always" validate="required" blankLabel="literal:Select
Service" class="form-control input-sm"/>
public SelectModel getSupportContractModel() {
System.out.println("supportContractModel");
List<SupportContract> supportContracts =
session.createCriteria(SupportContract.class).list();
System.out.println("size " + supportContracts.size());
return this.getSelectModelFactory().create(supportContracts, "name");
}
console output with query and sysout
supportContractModel
Hibernate: insert into company_contract (active, bulk_guarantee,
cancel_date, cancellation_message_id, company_id, creation_date,
end_date, minimum_guarantee, price, price_room, service_level_id,
start_date, support_contract_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?)
[WARN] spi.SqlExceptionHelper SQL Error: 1048, SQLState: 23000
spi.SqlExceptionHelper Column 'support_contract_id' cannot be null
property.PropertySupportContracts Render queue error in
BeforeRenderTemplate[property/SupportContracts:servicelevel]: Failure
reading parameter 'model' of component
property/SupportContracts:servicelevel: Column 'support_contract_id'
cannot be null
As long as the required field isn't null, there doesn't seem to be any
issues saving the form, this only appears to happen when I have a
blank option on a required field with a not null constraint on the
database.
Now I'm not sure if this really matters, but I am using this select
component within an ajaxformloop.
Am I using this component incorrectly, or is this in fact still a bug
with secure?
Secure issue https://issues.apache.org/jira/browse/TAP5-2204
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]