Clob and converter/validation
mheidt Oct 25, 2007 9:31 AMI am using 2.0.0CR2 and will test it against the latest nightly build once there is an error free version.
@Entity
@Table(name = "Components")
public class Components implements java.io.Serializable {
...
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name = "ID", unique = true, nullable = false)
public int getId() {
return this.id;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "VehicleFamilyID", nullable = false)
@NotNull
public VehicleFamilies getVehicleFamilies() {
return this.vehicleFamilies;
}
@Column(name = "Name", nullable = false, length = 50)
@NotNull
@Length(max = 50)
public String getName() {
return this.name;
}
@Column(name = "Description")
public Clob getDescription() {
return this.description;
}
...
**************************
@Stateless
@Name("componentsManager")
public class ComponentsManagerBean implements ComponentsManager {
...
@In(required=false, value="newComponent") @Out(required=false, value="newComponent")
private Components newComponent;
@Factory("newComponent")
public void createNewComponent(){
newComponent = new Components();
}
**************************
<h:form>
<s:validateAll>
<h:panelGrid columns="2">
<s:span styleClass="label">#{messages['component.name']}</s:span>
<s:decorate id="component_name">
<h:inputText value="#{newComponent.name}" required="true" />
<h:message for="component_name" />
</s:decorate>
<s:span styleClass="label">#{messages['component.description']}</s:span>
<s:decorate id="component_description">
<h:inputTextarea value="#{newComponent.description}" />
<h:message for="component_description" />
</s:decorate>
<s:span styleClass="label">#{messages['vehicle_family']}</s:span>
<s:decorate id="vehicle_family">
<h:selectOneMenu
value="#{newComponent.vehicleFamilies}"
required="true">
<f:selectItem
itemLabel="#{messages['component.select_vehicle_family']}"
itemValue="0" />
<f:selectItems value="#{componentsManager.vehicleFamiliesList}" />
<s:convertEntity />
</h:selectOneMenu>
<h:message for="vehicle_family" />
</s:decorate>
<f:facet name="footer">
<h:commandLink styleClass="button" action="#{componentsManager.createComponent}" >
<h:graphicImage url="/img/ok.gif"
title="#{messages.add_component}"
alt="#{messages['component.add']}"
/>
</h:commandLink>
</f:facet>
</h:panelGrid>
</s:validateAll>
</h:form>A submit throws a
Conversion Error setting value 'user input' for 'null Converter'.
The example works, when I erase the description row.
The selectOneMenu was throwing one as well when not using
<s:convertEntity />.
But what do I have to do with Clobs?
And what about my style?
Can I get rid of the @Factory somehow?
Thanx in advance