[EJB 3.0] - EJB QL requires useless item in select list
by owaind
I have the following EJB QL
select r.channel.id, sum(se.currentListeners), r from Request r
left join fetch r.channel c
left join fetch r.stats s
left join fetch s.statsEntries se
where r.createdDate > :startDate and r.createdDate < :endDate
group by r.channel
i want to get rid of the r in the select list but it wont let me, can anyone tell me why? in normal sql i wouldnt need the r in the select list. The problem is it takes time to instantiate those Request objects and its totally wasted. I want it to look like this:
select r.channel.id, sum(se.currentListeners) from Request r
left join fetch r.channel c
left join fetch r.stats s
left join fetch s.statsEntries se
where r.createdDate > :startDate and r.createdDate < :endDate
group by r.channel
lovely that would involve no wasted effort and speed up my query. Can anyone help me i dont understand why i need the r in the select list, is hibernate dumb?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994954#3994954
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3994954
19 years, 4 months
[JBoss jBPM] - Problems starting process from MDB (EJB3, JBPm 3.2 alpha 2)
by NiB
Hi
I have the following code to start a process:
anonymous wrote :
| private void kickOffProcess(String processname, String [] attrnames, java.io.Serializable[] attrvalues) {
| try {
| org.jbpm.JbpmContext jbpmcontext = org.jbpm.JbpmConfiguration.getInstance().createJbpmContext();
|
| ---------------------------------------------------
| THE FOLLOWING LINE CAUSES THE EXCEPTION
| .............................................................
| org.jbpm.graph.def.ProcessDefinition pd = jbpmcontext.getGraphSession().findLatestProcessDefinition(processname);
|
|
| org.jbpm.graph.exe.ProcessInstance pi = new org.jbpm.graph.exe.ProcessInstance(pd);
|
| for (int i=0;i<attrnames.length;i++)
| pi.getContextInstance().setVariable(attrnames,attrvalues);
| pi.signal();
|
|
| } catch (Exception ex) { // Kann ja immer passieren
| log.info("!!! ERROR WEPLACM Main MDB: Unbekannte Exception. Grund: "+ex);
| ex.printStackTrace();
| }
|
I get the following Exception (by the line marked above):
org.hibernate.HibernateException: hibernate.cfg.xml not found
Where do I have to store the hibernate.cfg.xml in my jar? And why? What else do I have to consider? The jar contains only a few entity and session beans as well as one MessageDrivenBean (with the code above). The beans work correct. I removed the logging-lines so that the code is more readable.
I am not quite sure how to start a process correctly (with non-deprecated api functions) so any hints would be great ;-)
Thank you!
Greetz
NiB
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994951#3994951
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3994951
19 years, 4 months
[EJB/JBoss] - Executing Outside Transaction
by murtuza52
Hello,
I am using JBoss 4.0.5, Eclipse 3.2 on windows XP. MySQL 5.0 as backend.
I have strange scenario, where in a stateless session bean, i am counting number of times a method A is called as per application requirement. The scenario is put in psuedo code as follows:
| SessionBean1{
| @TransactionAttribute(REQUIRED)
| methodA() throws exception{}
|
| @TransactionAttribute(REQUIRED)
| methodB() throws exception{}
| }
| SessionBean2{
| count(){
| read counter from database and increase counter
| }
| }
|
The counter must increase even when the methodA() is throws exception. The method execution is:
methodA() -> count() -> methodB()
The database changes that occur in all these methods are OK when things go right and all methods are executed sucessfuly. The peoblem occurs when any of the method throws exception. The changes are rolled back including the counter. Is there anyway i can execute count() method outside transaction so the changes in the database are not rolled back.
I am sure we can set database to read_uncommit but this is not what the rest of the application requires except for count table which is used to store count.
I'll appreciate your quick response.
Regards,
Murtuza
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994950#3994950
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3994950
19 years, 4 months