[JBoss Seam] - Dumb question: Links from a datatable
by SmokingAPipe
This is a totally dumb question but I have been trying to figure this out all day and I'm not making progress.
I have a Seam application. Like many applications, it displays a bunch of stuff in a DataTable. I happen to be using the Tomahawk DataTable, but it shouldn't be that different from a plain JSF DataTable.
Anyway, this table holds a list of Books. The last column is a link for Details, so you could click on that and get the details of the book.
The obvious way to do that is to have a Book as a DataTableModelSelected member. The user clicks the link, that book is selected, and it navigates over to the book-details.jsf page.
But none of this is working. I tried with a commandLink and commandButton, and they both correctly set the DataTableModelSelected member. But, no matter what their action is, they just redisplay the page instead of navigating on to the book-details.jsf page. I then tried to use a Seam s:link, and got the same behavior.
Surely there's a way to do this? This is just basic stuff. In PHP I would have used href="book-details.php?bookId=..." and that would have worked. Why is this so much harder in Seam?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3989523#3989523
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3989523
19Â years, 5Â months
[Persistence, JBoss/CMP, Hibernate, Database] - Hibernate createQuery() ClassCastException
by bcflynn2
Hey guys. I'm deploying Hibernate 3.2.1 within an ear folder in a JBoss 3.2 installation. This works well, except I've run into a problem I can't figure out. I have a hot deployed service that uses the following code to truncate a table prior to loading data:
public void clearData(Logger pLog)
{
Session session = CommonHibernateUtil.currentSession();
String hql = "delete from HibernateBean";
Query query = session.createQuery(hql);
int rowCount = query.executeUpdate();
pLog.info("Truncating table: " + String.valueOf(rowCount) + " rows deleted.");
CommonHibernateUtil.closeSession();
}
This works beautifully upon initial deployment, but if I redeploy without rebooting the server, I get the following error:
java.lang.ClassCastException
at org.hibernate.hql.ast.HqlLexer.makeToken(HqlLexer.java:39)
at org.hibernate.hql.antlr.HqlBaseLexer.mIDENT(HqlBaseLexer.java:580)
at org.hibernate.hql.antlr.HqlBaseLexer.nextToken(HqlBaseLexer.java:264)
at antlr.TokenBuffer.fill(TokenBuffer.java:69)
at antlr.TokenBuffer.LA(TokenBuffer.java:80)
at antlr.LLkParser.LA(LLkParser.java:52)
at org.hibernate.hql.antlr.HqlBaseParser.statement(HqlBaseParser.java:139)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:248)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:157)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at com.tamalesoftware.reporting.etl.tradehistory.TradeHistoryHibernateBeanFacade.clearData(Unknown Source)
at com.tamalesoftware.reporting.etl.tradehistory.TradeHistoryLoader.truncateTable(Unknown Source)
at com.tamalesoftware.reporting.etl.tradehistory.TradeHistoryLoader.preLoadActions(Unknown Source)
at com.tamalesoftware.reporting.etl.tradehistory.TradeHistoryLoader.startLoader(Unknown Source)
at com.tamalesoftware.reporting.etl.tradehistory.TradeHistoryLoader.(Unknown Source)
at com.tamalesoftware.reporting.etl.loaders.TradeHistoryScheduler.perform(Unknown Source)
at org.jboss.varia.scheduler.Scheduler$Listener.handleNotification(Scheduler.java:1236)
at org.jboss.mx.server.NotificationListenerProxy.handleNotification(NotificationListenerProxy.java:71)
at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.java:84)
at javax.management.timer.Timer.sendNotifications(Timer.java:441)
at javax.management.timer.Timer.access$000(Timer.java:31)
at javax.management.timer.Timer$RegisteredNotification.doRun(Timer.java:612)
at org.jboss.mx.util.SchedulableRunnable.run(SchedulableRunnable.java:164)
at org.jboss.mx.util.ThreadPool$Worker.run(ThreadPool.java:225)
I have played with this for hours; I focused on the hql caching in hibernate as JBoss class cast exceptions usually occur when an object isn't released from memory when undeployed. Even turning off Hibernate query cache and adding a '.setCacheable(false)' to the end of the createQuery() statement does not solve the problem. I have commented code out, and by process of elimination I have determined that the 'Query query = session.createQuery(hql);' is what causes the problem- even with an empty string for 'hql'. If I use a direct sql truncate statement rather than an hql statement (far less desirable), everything works correctly. Anyone have any suggestions? Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3989521#3989521
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3989521
19Â years, 5Â months