You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by nn kk <in...@abv.bg> on 2014/02/26 11:59:37 UTC
beaneditor for complex object
Hi I'm trying to create edit form for my hibernate entities.
For example:
@Entity
@Table(name = "SOME_OBJECT")
public class SomeObject implements Serializable {
...
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "SUB_OBJECT_ID", nullable = false)
private SubObject subObject;
...
}
How could I create edit form for this entity, I tried this way:
<div class="t-beaneditor">
<div>
<t:beaneditor t:object="someOBject" t:exclude="id" />
</div>
<div>
<t:beaneditor t:object="someOBject.subObject" t:exclude="id" />
</div>
<div class="t-beaneditor-row">
<input t:type="submit" value="Save" />
</div>
</div>
someOBject is marked as persisted, but the inner object bean edit form is not there
Any ideas?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: beaneditor for complex object
Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Wed, 26 Feb 2014 14:09:53 -0300, Kalle Korhonen
<ka...@gmail.com> wrote:
> Beaneditor doesn't handle nested entities. Beaneditor (or the underlying
> BeanEditForm) renders an html form and nested forms are not allowed.
BeanEditor does *not* render a <form> element, so you can nest a
BeanEditor inside another or inside a BeanEditForm.
And BeanEditForm is the one who uses a BeanEditor, not the opposite.
> @Thiago - your answer is for a different question.
I disagree. :) Actually, the original question is vague. What does "marked
as persistent" mean?
--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: beaneditor for complex object
Posted by Kalle Korhonen <ka...@gmail.com>.
Beaneditor doesn't handle nested entities. Beaneditor (or the underlying
BeanEditForm) renders an html form and nested forms are not allowed. One of
the simplest things you could do is to render just those field you actually
need to edit from the child object. Or, if you want a complete solution,
take a look at Tynamo's tapestry-model (
http://tynamo.org/tapestry-model+guide).
@Thiago - your answer is for a different question.
Kalle
On Wed, Feb 26, 2014 at 2:59 AM, nn kk <in...@abv.bg> wrote:
> Hi I'm trying to create edit form for my hibernate entities.
> For example:
> @Entity
> @Table(name = "SOME_OBJECT")
> public class SomeObject implements Serializable {
> ...
> @ManyToOne(fetch = FetchType.LAZY)
> @JoinColumn(name = "SUB_OBJECT_ID", nullable = false)
> private SubObject subObject;
> ...
> }
>
> How could I create edit form for this entity, I tried this way:
>
> <div class="t-beaneditor">
> <div>
> <t:beaneditor t:object="someOBject" t:exclude="id" />
> </div>
> <div>
> <t:beaneditor t:object="someOBject.subObject" t:exclude="id" />
> </div>
> <div class="t-beaneditor-row">
> <input t:type="submit" value="Save" />
> </div>
> </div>
>
> someOBject is marked as persisted, but the inner object bean edit form is
> not there
>
> Any ideas?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: beaneditor for complex object
Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
You should either explicitly persist the inner object itself or add a
cascading option to the relationship mapping. This isn't related to
Tapestry at all, just to the way you're using Hibernate.
On Wed, 26 Feb 2014 07:59:37 -0300, nn kk <in...@abv.bg> wrote:
> Hi I'm trying to create edit form for my hibernate entities.
> For example:
> @Entity
> @Table(name = "SOME_OBJECT")
> public class SomeObject implements Serializable {
> ...
> @ManyToOne(fetch = FetchType.LAZY)
> @JoinColumn(name = "SUB_OBJECT_ID", nullable = false)
> private SubObject subObject;
> ...
> }
>
> How could I create edit form for this entity, I tried this way:
>
> <div class="t-beaneditor">
> <div>
> <t:beaneditor t:object="someOBject" t:exclude="id" />
> </div>
> <div>
> <t:beaneditor t:object="someOBject.subObject" t:exclude="id" />
> </div>
> <div class="t-beaneditor-row">
> <input t:type="submit" value="Save" />
> </div>
> </div>
>
> someOBject is marked as persisted, but the inner object bean edit form
> is not there
>
> Any ideas?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org