I have an EntityHome that contains the following code. When I go to page to create the
entity, the myEntity factory variable is already populated with the first entity in the
dataModel list, even though nothing has been selected (and myEntityHome.managed evaluates
to true, even though it shouldn't, because nothing from the list has been selected).
Why might this be?
@Name("myEntityHome")
| public class MyEntityHome extends EntityHome<MyEntity> {
|
| @Factory
| public MyEntity getMyEntity() { return getInstance(); }
|
| @In("#{myQuery.dataModel.rowData}")
| public void setInstance(MyEntity instance) {
| super.setInstance(instance);
| }
|
| }
In the create page, I have the following. The first time I access the page, myEntity.name
is populated with the value of the first row of "myQuery.dataModel", even though
"myQuery.dataModel.rowData" should be empty because no row has yet been
selected. How do I fix this so that it behaves correctly and shows nothing, because
nothing has been selected? This should work, right?
<h:form>
| <h:inputText value="#{myEntity.name}" />
| <h:commandButton value="Create"
action="#{myEntityHome.persist}" />
| </h:form>
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4018467#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...