[JBoss Seam] - FlushModeType not working in Seam 1.2.1 GA?
by kotlusa
Environment:
I have tried this in serveral environments...
Seam 1.2.1
JBoss 4.0.5 and 4.2.1
Myfaces (JSF 1.1) and JSF 1.2 RI
Windows XP and Solaris 10
HSQLDB and Oracle
Scenario:
I have a basic situation where I want to edit an entity (and it's related entities on an edit page), go to a confirmation page and let the user either cancel or save their changes.
| @Begin(join=true, flushMode=FlushModeType.MANUAL)
| public String lookupBlah()
| {
| //lookup blah....
| return "edit";
| }
|
| public String editBlah()
| {
| em.merge(blah);
| return "edit";
| }
|
| @End
| public String cancelEdit()
| {
| return "home";
| }
|
| @End
| public String submitEdit()
| {
| em.flush();
| return "home";
| }
|
The Problem:
Unfortunately, this doesn't work for me. The changes are always persisted, even if the user clicks the cancel button. I am however able to manually tell the em not to flush by putting ((EntityManagerImpl)em.getDelegate()).getSession().setFlushMode(FlushMode.NEVER); at the first line of lookupBlah().
My Questions:
Any idea why setting the FlushModeType in @Begin isn't working? Does anyone else have it working? Does my call to the Hibernate Session's setFlushMode method break anything else?
Sidebar/feature request:
It would be great if @End had an optional parameter flush which defaults to true. This way you wouldn't have to call em.flush. Also, cancel methods would just have @End(flush=false) or something like that.
Seam Rocks!
Thank you,
Austin
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4083366#4083366
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4083366
18 years, 7 months
[JBoss Seam] - query restrictions with id primary key element
by jamesjmp
Hello,
by means of seam-gen I have a POJO with an id attribute. The id is in fact another POJO. All is ok according to the database.
I´ve defined a query in componentes.xml. It works properly:
| <framework:entity-query name="POJOView"
| ejbql="select pojo from POJO pojo">
| <framework:restrictions>
| <value>pojo.atb1 = #{object.atb1}</value>
| </framework:restrictions>
| </framework:entity-query>
But if I use a restriction wich access to an id attribute it returns no error but no elements, and there are elements indeed.(With standard sql that info is retrieved)
For example:
| <framework:entity-query name="POJOView"
| ejbql="select pojo from POJO pojo">
| <framework:restrictions>
| <value>pojo.id.atb2 = #{object.value}</value>
| </framework:restrictions>
| </framework:entity-query>
#{object.value} has a proper value for pojo.id.atb2, in the same way as #{object.atb1} has for pojo.atb1. All attributes have their public getters.
Is there something special that must be done for restrictions when accessing a pojo.id.attribute?
thank you!!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4083365#4083365
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4083365
18 years, 7 months