[jboss-user] [EJB 3.0] - Re: relationship does not prevent from deleting referenced e

2007-02-21 Thread micho
jboss-4.0.4.GA_1 is used View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4019896#4019896 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4019896 ___ jboss-user mailing list jboss-

[jboss-user] [EJB 3.0] - Re: relationship does not prevent from deleting referenced e

2007-02-21 Thread [EMAIL PROTECTED]
Try something like this: | @ManyToMany( targetEntity = Usergroup.class, cascade={CascadeType.MERGE, CascadeType.REFRESH}) | Best regards View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4020081#4020081 Reply to the post : http://www.jboss.com/i

[jboss-user] [EJB 3.0] - Re: relationship does not prevent from deleting referenced e

2007-02-21 Thread alexg79
Have you checked whether the correct foreign keys are in place in the database? If not, have you tried to drop the tables and allow Hibernate (which I assume you're using) to generate the tables again? On a side note, a few non related tips for you: 1. You don't need an explicit constructor if

[jboss-user] [EJB 3.0] - Re: relationship does not prevent from deleting referenced e

2007-02-21 Thread micho
Thanks a lot for the help. In the DB there are no foreign keys. Inspecting the Database, I saw, that the tabletype is MyISAM whitch I think doenot support foreign keys. How can I tell Hibernate to create the tables with type innodb? I tried dropping the tables. The uniqueconstraint, which wasn´t

[jboss-user] [EJB 3.0] - Re: relationship does not prevent from deleting referenced e

2007-02-22 Thread alexg79
You can instruct MySQL to create InnoDB tables by default. Just put | default-table-type=innodb | under [mysqld], and you're set. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4020499#4020499 Reply to the post : http://www.jboss.com/index.html?module=bb

[jboss-user] [EJB 3.0] - Re: relationship does not prevent from deleting referenced e

2007-02-22 Thread micho
thanks a lot, that works fine now, and with innodb tables the referential integritay is not violated. But I´, not sure, how to act here correctly. I catch two (identical?) runtimeexceptions - why two? java.lang.RuntimeException: org.jboss.tm.JBossRollbackException: Unable to commit, tx=Transact

[jboss-user] [EJB 3.0] - Re: relationship does not prevent from deleting referenced e

2007-02-22 Thread micho
I try to detect the constraintviolation now via catch (RuntimeException e) | { if (e.getCause().getCause().getCause().getClass().toString().equals("class org.hibernate.exception.ConstraintViolationException") ) | { DO SOMETHING is that OK? But there are two things I don´t understand. 1)

[jboss-user] [EJB 3.0] - Re: relationship does not prevent from deleting referenced e

2007-02-22 Thread micho
for point 1, the double Exception, I detected, that only one exception was thrown. the loggger.error produces double output, logger.debug doesnot. But I still don´t know, why this happens and wyh I can´t catch the exception when calling em.remove View the original post : http://www.jboss.c