Hi all,
I'm trying to use the BeanEditForm for editing the data of a object and
persist it using hibernate.
Here are some code snippets:
Page Class:
public class AdministrationGroupsEdit
{
@Inject
Session session;
@InjectPage
AdministrationGroups redirectPage;
private Integer groupId;
@Property
private Group group;
void onActivate(Integer personId)
{
this.groupId = personId;
}
void setupRender()
{
this.group = (Group) this.session.createQuery("from Group where
id= :p_id")
.setInteger("p_id", this.groupId)
.uniqueResult();
}
@CommitAfter
void onValidateFromGroupForm()
{
this.session.merge(this.group);
}
AdministrationGroups onSuccess()
{
return this.redirectPage;
}
}
My Page itself looks like this:
...
<t:beaneditform t:id="groupForm" object="group"
submitLabel="Save">
[BeanEditForm here]
</t:beaneditform>
...
And here is my mode:
@Entity
@Table(name = "group", schema = "public")
public class Group implements java.io.Serializable
{
private int id;
private String guid;
private String name;
public Group()
{
}
@Id
@NonVisual
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public int getId()
{
return this.id;
}
public void setId(int groupId)
{
this.id = groupId;
}
@Column(name = "name")
public String getName()
{
return this.name;
}
public void setName(String name)
{
this.name = name;
}
@Column(name = "guid")
@NonVisual
public String getGuid()
{
return this.guid;
}
public void setGuid(String guid)
{
this.guid = guid;
}
...
}
So you can see i marked the guid and id property as @NonVisual which
seems not to work. The property is not displayed in the beaneditform but
also the value is lost when onSuccess() or onValidateFromGroupForm() is
called. I expected non visual properties to be stored in hidden fields
or something like this!? This seems to be not the default behavoir
because the documentation says: @NonVisual could be used for id
fields... but in my application the values are lost...
Am I missing something?
Btw: Is there a better way than using the @NonVisual annotation cause i
dont't want to put this in my property.
Thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org