On 11/15/07, Rob Hills <[EMAIL PROTECTED]> wrote:
>
> Hi Michael,
>
> Michael Horwitz wrote:
> > On the assumption that you have OpenSessionInView filter uncommented,
> > then yes. Transaction boundary is on the manager, so if you are
> > calling multiple managers from a single action during the request,
> > there may be an issue. A lot also depends on the Cascade parameters
> > you have set on your entity relationships.
> Yes, I have the "LazyLoadingFilter" and its mapping uncommented. Much
> earlier I had some lazy loading issues that went away when I uncommented
> those filters.
>
> With respect to Cascade, I'm using CascadeType.ALL on my parent object,
> which seemed like the right thing to do. The relevant annotations are
> (in case I've done something else dopey there, which is quite possible):
>
> Parent POJO:
> @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY,
> mappedBy="parent", targetEntity = Child.class)
> public Set<Child> getChildren() {
> return this.children;
> }
>
> Child POJO:
>
> @ManyToOne(fetch=FetchType.LAZY)
> @JoinColumn(name="parent_id", nullable=false)
> public Parent getParent() {
> return parent;
> }
Can't see anything wrong there. I know some people have claimed there is
some weirdness going on with CascadeType.ALL. You may want to try adding the
Hibernate specific @Cascade annotation with CascadeType.MERGE ( the
Hibernate CascadeType) and see if your problem goes away. If it does please
report back so we can alert others.....
Any specific errors we can look at? May help to help, so to speak.
Mike.
>
> > On 11/15/07, *Rob Hills* <[EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>> wrote:
> >
> > Hi All,
> >
> > I'm using AppFuse 2.0 + Hibernate + Struts.
> >
> > I'm having some issues with persisting entities to the database
> > where I make
> > changes to a Parent entity and some related Child entities and
> > then save the
> > parent.
> >
> > I have been assuming that GenericManager and GenericDao classes will
> > seamlessly handle all the back end stuff (transactions, db updates
> > etc.), but
> > I'm getting weird Hibernate errors. I thought I'd better do a
> > reality check
> > before I troll back through my code looking for causes of the
> problem.
> >
> > Hence my question. Am I right in assuming that GenericManager and
> > GenericDao will happily handle updates to Parent and Child
> > entities in the
> > one session?
> >
> TIA,
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>