[Persistence, JBoss/CMP, Hibernate, Database] - Cleaning database through hibernate
by hamtho2
Hi,
is there a good way to clean the whole database through hibernate?
The background is as follows: I want to clean the database every time before starting a new testcase, to make sure the database is empty and in a defined state. Currently I´m doing this through dropping the scheme and restarting the session, but this takes very long. Therefor a CREATE-DROP in the hibernate-configuratoin would not be very suitable as well, as I want to prevent hibernate from doing the mapping everytime.
I tried doing it through the Criteria-API, fetching all java.lang.Objects and performing a session.delete(object) on every object, but this leads to a not-null or transient object exception, although I did it in one transaction with setting the flushMode to "commit".
The other way I tried was doing this through HQL, but this leads to the problem, that I´m working with @CollectionOfElements which I cannot reference through hql (or at least I haven´t found a way to do it), but the HQL does explicitly no cascades.
Any help would be greatly appriciated.
Thomas
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088738#4088738
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4088738
18 years, 7 months
[JBoss Seam] - Re: Entity Convert
by atzbert
Hi there..
I have a very similar problem. In fact I am fighting with it for weeks now, postponing its solution over and over...I don't know when it happened the first time, but it arose out of the blue.
I am using Seam 1.2.1GA on JBoss 4.0.5GA with Facelets, Ajax4JSF, seam managed persisten context, and JSF 1.2 RI.
It's the User entity, a select many dropdown will give me random invalid values for the select items in it. Say, there are 10 values in that list, all are shown, then the first, the 3rd and maybe the fifth will be accepted all others receive a "value is not valid". On the same page I am using the selectItems with another entity type (Customer) with no problem at all. Further I am deriving my entities all from a DbItem super class which ensures ID equality and such...
I tried nearly everything imaginable. Changed the entity name, refactored the class name, copied the entityConverter and overrode it with my more verbose implementation. I really have no idea why this happens only for this particular entity. I was even migrating to Seam-2CR1 tested it shortly and noticed the same problem, but with a minor difference: after trying to apply the values, i.e. submitting the form, the rerendered paged showed empty labels in the dropdown, with all values set to ??.noSelectionValue???...
Does this sound familiar to anybody? Or is there anybody out there having an idea for a possible solution?
Pete?
thanks,
Tino
The XHTML piece:
| <h:selectOneMenu value="#{query.example.cataloguer}" id="item_cataloguer">
| <s:selectItems value="#{allUserList.resultList}" var="user" label="#{user.stringRep}"/>
| <s:convertEntity/>
| </h:selectOneMenu>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088734#4088734
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4088734
18 years, 7 months