[JBoss Seam] - Possible bug - POJO doesn't automatically join transaction
by ASavitsky
Environment: Tomcat 5.5 + Seam 2.1.0 + Microcontainer, Seam-managed transactions and PCs.
UserBean.java - displays a list of existing User records, allowing user to select one (a-la "clickable lists" example) and edit it, or to create a new record:
@Name ("userBean")
| @Scope (ScopeType.CONVERSATION)
| @Transactional
| public class UserBean extends EntityController {
| @DataModelSelection
| @Out (required = false)
| private User selectedUser;
| @DataModel
| private List<User> users;
|
| public void addUser() {
| selectedUser = new User();
| }
| public void cancelEdit() {
| selectedUser = null;
| }
| @Factory ("users")
| @Begin (flushMode = FlushModeType.MANUAL)
| public void createRecords() {
| users = createQuery("SELECT u FROM User u").getResultList();
| }
| public void saveUser() {
| // getEntityManager().joinTransaction();
| persist(selectedUser);
| flush();
| addFacesMessage("User #{selectedUser.username} succesfully saved");
| createRecords();
| }
| public void selectUser() {
| }
| }
|
When executing saveUser(), if selectedUser is a transient (new) instance, the flush() call throws a "javax.persistence.TransactionRequiredException: no transaction is in progress". If the first line is uncommented, the save completes successfully (verified in DB). When selectedUser is a managed (existing) instance, the updates complete successfully whether the first line is commented or not.
Is this a bug? Am I using the bean in a correct way?
Thanks,
Alex
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4034230#4034230
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4034230
19 years
[JBoss Seam] - Query caching with Seam
by mgrouch
How do I use caching for queries with Seam?
Do I have to annotate Action which extends EntityQuery?
Or do I need to extend from HibernateEntityQuery instead and override
get getCacheable?
I use JPA Seam/WebLogic/EhCache/Hibernate.
Can EhCache be used under JPA with hibernate on WebLogic?
Are there any documents which describe how to cache queries with Seam?
Thanks a lot
PS: My action class
| public class EmailList extends EntityQuery {
|
| private static final String[] RESTRICTIONS = {};
|
| private Email email = new Email();
|
| @Override
| public String getEjbql() {
| return "select email from Email email ";
| }
|
| @Override
| public Integer getMaxResults() {
| return 25;
| }
|
| public Email getEmail() {
| return email ;
| }
|
| @Override
| public List<String> getRestrictions() {
| return Arrays.asList(RESTRICTIONS);
| }
|
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4034228#4034228
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4034228
19 years
[JBoss Seam] - Help! A4JSF a:support problem
by damatrix
Hello,
I'm using seam 1.2.1.GA, and ajax4jsf. Following the booking example, I have an actionListener attached to an "onblur" event on an a:support tag as follows
| <s:decorate id="titleDecorate" template="../templates/edit.xhtml">
| <ui:define name="label">Title </ui:define>
| <h:inputText id="title" value="#{fairManager.objectTitle}" required="true">
| <a:support event="onblur" actionListener="#{fairManager.checkTitle}" reRender="titleDecorate"/>
| </h:inputText>
|
| </s:decorate>
|
The "fairManager" here is a CONVERSATION scoped stateful session bean. When i debug, i find that the "fairManager.checkTitle" method is never called. The method is specified on the interface as all methods should. Is there any reason why it shouldn't work? I have a similar actionListener on a SESSION scoped SFSB, and it works alright. I don't know why this one doesn't.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4034226#4034226
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4034226
19 years
[JCA/JBoss] - Re: Are exception-sorter expected to work for xa-datasource?
by weston.price@jboss.com
anonymous wrote :
| I'm familiar with <check-valid-connection-sql>. The point of this exception-sorter exercise is to get away from the high expense of that approach. Ideally, we want to accept the cost of a single failure - followed by immediate invalidation of the pool - rather than the overhead of very frequent connection checks.
|
There is no notion of a 'purge policy' in JBoss as this time where the pool is invalidated based on the error state of a *single* failing connection. There is some debate on including this for a future release.
JBoss 4.0.5 includes a background validation mechanism to evaluate pooled connections in the background rather than on retrieval which alleviates the overhead of constant validation.
anonymous wrote :
| The distinction between XA errors and connection errors is an artifact of how the XA transactions are managed.
|
The difference is simply in the origin of the exception. XA based errors are reported from the underlying XA resource which don't currently have a hook to evaluate the error. Again, there is no reason why this couldn't be added.
As for the underlying MC being null, there are a few things that could cause this
1) The connection has been closed and you attempt to reuse the handle
2) The connection has been closed in another thread, and you attempt to reuse the handle
3) You are attempting to reuse the connection across method calls in an EJB and you do not have the spec compliant attribute set to true on the CachedConnectionManager (you would never really want to do this anyway).
4) You are not using connection validation and you have been given an invalid connection from the pool (this would be my guess).
However, I am not seeing this in the stacktrace you posted. If the MC was actually null, you would never be able to execute a prepared statement, we check for this prior to every invocation to prohibit this behavior. I apologize if I am not looking in the right place.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4034225#4034225
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4034225
19 years