[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - update using data from multiple tables

drougge do-not-reply at jboss.com
Tue Aug 21 09:30:18 EDT 2007


Hello there!

I'm trying to figure out how to do this in JPQL. It's a pretty straightforward statement but I'm at a loss as of finding any example on how to do this. All example queries I can find are of the very simple sort.

Here's an example of a multi table update in ordinary SQL. It associates a call with the owner active at the time of that call.

UPDATE cdr_raw, inventory_anr, anr
SET cdr_raw.inventory_anrid = inventory_anr.id
WHERE inventory_anr.anrid = anr.id AND cdr_raw.anr = anr.nr AND cdr_raw.ts >= inventory_anr.stimeframe AND (cdr_raw.ts < inventory_anr.etimeframe OR inventory_anr.etimeframe is null);

Please, if any of you knows more about this then post a reply here. It would be greatly appreciated. We really like to avoid making native queries as far as possible.

/Magnus


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4076284#4076284

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4076284



More information about the jboss-user mailing list