[EJB 3.0] - deleting objects in a Collection based OneToMany mapping
by aberezin
I am using Jboss 4.0.4.ga and have a OneToMany like this
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "order")
public Collection getLineItems() {
return lineItems;
}
On the other side, I have this:
@ManyToOne
@JoinColumn(name = "order_id")
public Order getOrder() {
return order;
}
I persist an Order with one LineItem. I then clear the collection of LineItems and repersist (actually call em.merge(Object) ) the Order.
Jboss doesnt appear to delete the underlying row in the LineItem table.
I cant understand from the docs if the cascade = CascadeType.ALL implies that the contained objects should be deleted from the datastore when they are removed from a Collection. The docs seem to indicate this is not done for a ManyToMany bc it is not possible to know if the objects that are removed from a collection are still referenced by another entity. However, it does seem that in a OneToMany, JBOSS could know enough to delete the dependent entites from the datastore.
Thanks for any help on this one.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3969258#3969258
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3969258
19 years, 7 months
[JBoss Seam] - Re: JBoss Rules problem (where else to post?)
by dgallego
You shouldn't use an absolute path to load your rules.
Instead, use this method (extracted from Drools examples and modified).
| public static RuleBase readRule(Class readerClass, String rulesFile, String rulesDslFile) throws Exception
| {
| if (rulesFile == null)
| return null;
| PackageBuilder builder = new PackageBuilder();
| Reader source = new InputStreamReader(readerClass.getResourceAsStream(rulesFile));
| if (rulesDslFile == null)
| builder.addPackageFromDrl(source);
| else
| {
| Reader dsl = new InputStreamReader(readerClass.getResourceAsStream(rulesDslFile));
| builder.addPackageFromDrl(source, dsl);
| }
| RuleBase ruleBase = RuleBaseFactory.newRuleBase();
| Package pkg = builder.getPackage();
| ruleBase.addPackage(pkg);
| return ruleBase;
| }
|
[...]
| RuleBase ruleBase = readRule(MyClass.class, "rules.drl", null);
| WorkingMemory wm = ruleBase.newWorkingMemory();
|
Hope it helps.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3969256#3969256
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3969256
19 years, 7 months
[JBoss Eclipse IDE (users)] - Re: hibernate tools hangs eclipse
by bugra
> do you have just the hibernate tools installed or also the rest of jobsside installed ?
I have only hibernate tools installed.
> Where you editing some xml while it were happening ?
It could be possible that I had a few editor windows (tabs) open with XML files. but the "second" before the hang up of eclipse I wasn't on this editor tab. so the answer would be, I had open XML editor tabs but i was not editing them.
> ... unless the jdbc driver were having a hard time to connect to the db ..could this be the case ?
i don't think so. I'm currently using Apache Derby 10.1 "Nature" as a project in eclipse (starting & stopping the server from inside eclipse) - for testing purposes - and using "org.apache.derby.jdbc.ClientDriver" driver. since the DB is on the same box the connectivity shouldn't be a problem.
thanks for your feedback.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3969252#3969252
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3969252
19 years, 7 months