You seem to have three basic errors:

1) In action class com.giavaviet.app.webapp.action.PhuongForm on line 39 you
are trying to cast a Quan object to be a Phuong object.
2) In action class com.giavaviet.app.webapp.action.PhuongList you are trying
to sort a list of Phuong using the column 'id_phuong'. Phuong objects have
no such attribute.
3) Your database sample data does not contain a Quan object with id -2.

Mike.

On 9/19/07, phamvubinh <[EMAIL PROTECTED]> wrote:
>
>
> Thanks for your help, Mike. I can run mvn jetty:run-war without the
> previous
> error, but after that, I met some things wrong :-((. Can you help me.
>
> You can see my error message below:
>
> ==========================================================
>
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.099 sec
> Running com.giavaviet.app.webapp.action.PhuongFormTest
> [webgisdulich] DEBUG [main] PhuongFormTest.testEdit(40) | testing edit...
> [webgisdulich] DEBUG [main] PhuongFormTest.testSave(49) | testing save...
> [webgisdulich] DEBUG [main] PhuongFormTest.testRemove(65) | testing
> remove...
> Tests run: 4, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.419 sec
> <<< FAILURE!
> testEdit(com.giavaviet.app.webapp.action.PhuongFormTest)  Time elapsed:
> 0.107 sec  <<< ERROR!
> java.lang.ClassCastException: com.giavaviet.app.model.Quan cannot be cast
> to
> com.giavaviet.app.model.Phuong
>        at
> com.giavaviet.app.webapp.action.PhuongForm.edit(PhuongForm.java:39)
>        at
> com.giavaviet.app.webapp.action.PhuongFormTest.testEdit(
> PhuongFormTest.java:43)
>
> testSave(com.giavaviet.app.webapp.action.PhuongFormTest)  Time elapsed:
> 0.073 sec  <<< ERROR!
> java.lang.ClassCastException: com.giavaviet.app.model.Quan cannot be cast
> to
> com.giavaviet.app.model.Phuong
>        at
> com.giavaviet.app.webapp.action.PhuongForm.edit(PhuongForm.java:39)
>        at
> com.giavaviet.app.webapp.action.PhuongFormTest.testSave(
> PhuongFormTest.java:52)
>
> Running com.giavaviet.app.webapp.action.PhuongListTest
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.334 sec
> <<< FAILURE!
> testSearch(com.giavaviet.app.webapp.action.PhuongListTest)  Time elapsed:
> 0.325 sec  <<< ERROR!
> java.lang.ClassCastException: java.lang.NoSuchMethodException: Unknown
> property 'id_phuong'
>        at
> org.apache.commons.beanutils.BeanComparator.compare(BeanComparator.java
> :155)
>        at
> org.apache.commons.collections.comparators.ReverseComparator.compare(
> ReverseComparator.java:80)
>        at java.util.Arrays.mergeSort(Arrays.java:1270)
>        at java.util.Arrays.sort(Arrays.java:1210)
>        at java.util.Collections.sort(Collections.java:159)
>        at org.appfuse.webapp.action.BasePage.sort(BasePage.java:262)
>        at
> com.giavaviet.app.webapp.action.PhuongList.getPhuongs(PhuongList.java:22)
>        at
> com.giavaviet.app.webapp.action.PhuongListTest.testSearch(
> PhuongListTest.java:37)
>
> Running com.giavaviet.app.AppTest
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.02 sec
> Running com.giavaviet.app.webapp.action.QuanFormTest
> [webgisdulich] DEBUG [main] QuanFormTest.testEdit(40) | testing edit...
> [webgisdulich] DEBUG [main] QuanFormTest.testSave(49) | testing save...
> [webgisdulich] DEBUG [main] QuanFormTest.testRemove(65) | testing
> remove...
> [webgisdulich] WARN [main] GenericDaoHibernate.get(60) | Uh oh, 'class
> com.giavaviet.app.model.Quan' object with id '-2' not found...
> Tests run: 4, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.411 sec
> <<< FAILURE!
> testRemove(com.giavaviet.app.webapp.action.QuanFormTest)  Time elapsed:
> 0.074 sec  <<< ERROR!
> org.springframework.orm.ObjectRetrievalFailureException: Object of class
> [com.giavaviet.app.model.Quan] with identifier [-2]: not found
>        at
> org.appfuse.dao.hibernate.GenericDaoHibernate.get(GenericDaoHibernate.java
> :61)
>        at
> org.appfuse.dao.hibernate.GenericDaoHibernate.remove(
> GenericDaoHibernate.java:88)
>        at
> org.appfuse.service.impl.GenericManagerImpl.remove(GenericManagerImpl.java
> :96)
>
> ================================================================
>
> Any suggestion for me.
>
> Thanks very much
>
> Binh Pham
>
>
> Mike Horwitz wrote:
> >
> > Cascading of delete is not supported in the JPA spec, so you will need
> to
> > use the @OnDelete Hibernate extension to do it:
> http://tinyurl.com/22n4wv
> >
> > Mike
> >
> > On 9/19/07, phamvubinh <[EMAIL PROTECTED]> wrote:
> >>
> >>
> >> I have the same error. Any suggestion for this mistake?
> >> Donleyp, have you found the solution?
> >>
> >> Thanks
> >> Binh Pham
> >>
> >>
> >>
> >> donleyp wrote:
> >> >
> >> > I am getting the following error when I try to delete a user:
> >> > "java.sql.SQLException: ORA-02292: integrity constraint
> >> > (FTAP_DEMO.FK1D0C220DF503D155) violated - child record found"
> >> >
> >> > I looked at the DDL generated by hibernate and it does not contain
> the
> >> > cascade delete clause in the alter table statement for this foreign
> >> key.
> >> I
> >> > am trying to figure out if it is possible to get that clause added.
> >> >
> >> > I have a domain object that associates itself with a user
> (represented
> >> by
> >> > org.appfuse.model.User). Here are the setter and getter for it:
> >> >       /**
> >> >        * @return the user
> >> >        */
> >> >       @ManyToOne(cascade = CascadeType.ALL, optional = false)
> >> >       public User getUser()
> >> >       {
> >> >               return user;
> >> >       }
> >> >
> >> >       /**
> >> >        * @param user
> >> >        *            the user to set
> >> >        */
> >> >       public void setUser(User user) {
> >> >               this.user = user;
> >> >       }
> >> >
> >> > From my reading of the persistence spec, that "cascade=
> CascadeType.ALL"
> >> is
> >> > only really for operations originating on the this object, so it is
> not
> >> > doing me any good. I need a way to tell hibernate that it should
> >> cascade
> >> > deletes from user to this object. Any suggestions?
> >> >
> >> > Thanks!
> >> >
> >> > Donley
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Cascading-delete-from-User-to-my-own-model-objects.-tf3854160s2369.html#a12770256
> >> Sent from the AppFuse - User mailing list archive at Nabble.com.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> >
>
>
> --
> View this message in context:
> http://www.nabble.com/Cascading-delete-from-User-to-my-own-model-objects.-tf3854160s2369.html#a12773596
> Sent from the AppFuse - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to