[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3733) Introduce an annotation to disable ad-hoc null semantic of Hibernate components
Vladimir Kovalyuk (JIRA)
noreply at atlassian.com
Tue Jan 27 07:21:38 EST 2009
Introduce an annotation to disable ad-hoc null semantic of Hibernate components
-------------------------------------------------------------------------------
Key: HHH-3733
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3733
Project: Hibernate Core
Issue Type: Improvement
Components: core
Reporter: Vladimir Kovalyuk
see http://forums.hibernate.org/viewtopic.php?t=993972
For the model
@Entity
public class Person {
private Address name = new Address();
...
@Embedded Address getAddress() {}
}
@Embeddable
public class Address {
public String getCity() {}
public String getStreet() {}
}
the following xhtml excerpt causes NPE constantly when editing a person which address properties hasn't been filled in yet
<h:inputText value="#{person.address.city}" />
I suggest introducing an annotation @Static which could be applied to Address class and lead to disabling null ad-hoc semantic on its instances.
For some environments such as user interface this may be considered as the default behavior. I suggest introducing an Hibernate configuration parameter which would switch off the semantic.
I would propose to consider embeddable classes as static mixins from OO design, not as just limited entities without identity. This point of view explains that embedded instance is a part of entity so it's lifecycle is the same as the entity's lifecycle. Thus constant presence of embeddable instance (property is never null) is the default behavior. Thus configuration parameter is "must have", not the thing which is "nice to have".
>From the other hand null ad-hoc semantic is like dynamic mixins. So it would be nice to have a @Dynamic annotation to force this semantic for some components.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list