[EJB 3.0] - order-by in named-query
by eiben
Hi,
I created a named query like this:
| @NamedQuery(name = "topItems", query = "select i from Orderitem oi inner join oi.item i group by i order by sum(oi.quantity) desc")
|
| public Collection<Item> getTopItems()
| {
| Query q = em.createNamedQuery("topItems");
| q.setMaxResults(25);
| return (Collection<Item>) q.getResultList();
| }
|
But this doesn't seem to work like I expect it to work: I get an exception from the JDBC-driver :( It seems like my database (MySQL) doesn't like the "sum(oi.quantity)" in the order by clause :(
well, I played with the sql, and it seems like MySQL would prefer something like this:
| @NamedQuery(name = "topItems", query = "select i, sum(oi.quantity) as qty from Orderitem oi inner join oi.item i group by i order by qty desc")
|
But this in turn doesn't seem to work with hibernate, at least I tried to evaluate this expression in the HQL-Editor, and hibernate could not create a SQL-statment :(
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024559#4024559
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024559
17Â years, 10Â months
[Security & JAAS/JBoss] - Re: I need helps from anyone about JAAS with DatabaseServerL
by changemylife
Thanks jaikiran!
I solved my problems! But I wondered that: If I write my login-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
|
| <policy>
| <application-policy name = "DB-Domain">
| <authentication>
| <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule"
| flag = "required">
| <module-option name = "unauthenticatedIdentity">guest</module-option>
| <module-option name = "dsJndiName">java:/DefaultDS</module-option>
| <module-option name = "principalsQuery">SELECT PASSWD FROM USERS WHERE USERID=?</module-option>
| <module-option name = "rolesQuery">SELECT ROLEID, 'Roles' FROM ROLES WHERE USERID=?</module-option>
| </login-module>
| </authentication>
| </application-policy>
| </policy>
When the authentication will fail! But if I use login-config.xml inside \server\default\conf and add some informations (above) the authentication success! Why ?( If I want myself write my login-config.xml)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024553#4024553
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024553
17Â years, 10Â months
[JBossCache] - Configure EvictionPolicy on JBoss 4.0.5 Doubt
by mp123
Hello,
I'm trying to run the clusterstore EJB3 TrailBlazer POJO Clustering and Caching demo application.
The demo src consists the file "clusterstore-cache-service.xml" and it is having the following code snippet for configuring TreeCache eviction policy.
| <!-- Specific eviction policy configurations. This is LRU -->
| <attribute name="EvictionPolicyConfig">
| <config>
| <attribute name="wakeUpIntervalSeconds">5</attribute>
| <!-- Cache wide default -->
| <region name="/_default_">
| <attribute name="maxNodes">5000</attribute>
| <attribute name="timeToLiveSeconds">1000</attribute>
| </region>
|
| <!-- The Credit Verification query cache -->
| <region name="/CreditVerification">
| <attribute name="maxNodes">1000</attribute>
| <attribute name="timeToLiveSeconds">5000</attribute>
| </region>
|
| </config>
| </attribute>
|
|
After deploying the demo application in the deploy directory of one node in the cluster(only one node available in the cluster), it gives the following Warnings.
| 05:58:35,385 INFO [STDOUT] purchase for username1
| 05:58:35,405 INFO [STDOUT] Send mesg to ccproc
| 05:58:35,408 INFO [STDOUT] The Msg ID is ID:4-11728151154051
| 05:57:50,727 INFO [STDOUT] Finalized order called
| 05:57:50,728 WARN [TreeCache] node /CreditVerification not found
| 05:57:55,822 INFO [STDOUT] Finalized order called
| 05:57:55,823 WARN [TreeCache] node /CreditVerification not found
| 05:58:00,946 INFO [STDOUT] Finalized order called
| 05:58:00,947 WARN [TreeCache] node /CreditVerification not found
| 05:58:35,424 INFO [STDOUT] Finalized order called
| 05:58:35,425 WARN [TreeCache] node /CreditVerification not found
|
Whats the problem here? Is there anyother file also need to specify the "region name"?
Please help me to solve this.
Thanks in Advance,
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024552#4024552
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024552
17Â years, 10Â months