Hibernate version:
3.0.5
Mapping documents:
Code:
<component name="webAddress" class="WebAddress">
<property name="url" column="WEB" insert="true" access="property" type="string"/>
</component>
I use a component for the web address so I can use a validate method on the url. Though when the database field WEB is null the containing object webAddress is not created but set to null.
The same effect happens when I use the not-null attribute.
Code:
<component name="webAddress" class="WebAddress">
<property name="url" column="WEB" insert="true" access="property" type="string" not-null="true"/>
</component>
The only workaround I have found is to use a second dummy property that uses a formula.
Code:
<component name="webAddress" class="WebAddress">
<property name="url" column="WEB" insert="true" access="property" type="string"/>
<property name="dummy" formula="''"/>
</component>
What else can I do?[/code]