[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: Can't catch exception caused by unique constraint?
In fact, I'm using a manual flushing, that's the reason it was working in JBoss 4.2.3. My service: | @Stateless | @Name(genericService) | @AutoCreate | public class GenericServiceBean implements GenericService { | | | @In(value = #{entityManager}) | private EntityManager em; | | public void create(Object entity) throws EntryDuplicatedException { | try { | em.persist(entity); | em.flush(); | } catch (EntityExistsException e) { | throw new EntryDuplicatedException(); | } | } | In the above code the EntityManager is a Seam Manager Persistence Context, which has been initiated with flush type manual in an invoker bean. Notice that the same version of Seam is being used, so I discarted this could be a problem of Seam version. My EntryDuplicatedException: | @ApplicationException(rollback = true) | public class EntryDuplicatedException extends Exception { | | | public EntryDuplicatedException() { | } | | public EntryDuplicatedException(String message) { | super(message); | } | | public EntryDuplicatedException(Throwable cause) { | super(cause); | } | } | The exception thrown in JBoss 5.1.0, where the same above code does not work, I can't catch the exception: | 10:28:40,652 INFO [STDOUT] Hibernate: insert into PAIS (CODIGOAREA, ID_COMPANIA, NOMBRE, PREFIJO, VERSION, ID_PAIS) values (?, ?, ?, ?, ?, ?) | 10:28:40,655 WARN [JDBCExceptionReporter] SQL Error: 1062, SQLState: 23000 | 10:28:40,656 ERROR [JDBCExceptionReporter] Duplicate entry 'Bolivia' for key 2 | 10:28:40,656 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session | org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update | at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94) | at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) | at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275) | at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266) | at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167) | at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321) | at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50) | at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027) | at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:304) | at org.jboss.seam.persistence.EntityManagerProxy.flush(EntityManagerProxy.java:92) | at com.jatun.eos.framework.service.GenericServiceBean.create(GenericServiceBean.java:42) | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | at java.lang.reflect.Method.invoke(Method.java:597) | at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111) | at org.jboss.ejb3.EJBContainerInvocationWrapper.invokeNext(EJBContainerInvocationWrapper.java:69) | at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor$InvocationContext.proceed(InvocationContextInterceptor.java:138) | at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44) | at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) | at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28) | at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) | at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77) | at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) | at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) | at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) | at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:29) | at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) | at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:30) | at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) | at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) | at
[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: Can't catch exception caused by unique constraint?
jaikiran wrote : This looks like a Hibernate EntityManager problem http://opensource.atlassian.com/projects/hibernate/browse/EJB-382. JBoss AS 5.1.0 GA ships with 3.4.0 GA version of Hibernate Entitymanager and the bug is reported against that version. Seems to be fixed in 3.4.1 Yes you're right, I changed the caught exception to PersistenceException and it works as expected. So I hope the next JBoss version can have this hibernate fix (of course if they release it). Thanks for your help. View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=4238347#4238347 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=4238347 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: Can't catch exception caused by unique constraint?
Did you find some solution to this problem? I had my application working pretty fine catching a EntityExistsException and throwing my own @ApplicationException exception in JBoss 4.2.3. Now that I upgraded to JBoss 5.1, the same code does not work anymore, I'm unable to catch neither EntityExistsException or ConstraintViolationException. Do you (or somebody else) know what can I do? I would really like to use JBoss 5 instead 4.2.3, but this problem is annoying me. Please help! View the original post : http://www.jboss.org/index.html?module=bbop=viewtopicp=4237945#4237945 Reply to the post : http://www.jboss.org/index.html?module=bbop=postingmode=replyp=4237945 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: [NEWBIE Q] redirecting to a certain page if already logg
Try the following change: | | ?xml version=1.0 encoding=UTF-8? | page xmlns=http://jboss.com/products/seam/pages; | xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; | xsi:schemaLocation=http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd; | login-required=false action=#{userAuthenticator.checkLogin} | | navigation from-action=#{userAuthenticator.checkLogin} |rule if=#{identity.loggedIn} | redirect view-id=/dashboard1234.xhtml/ |/rule | /navigation | | navigation from-action=#{identity.logout} | redirect view-id=/login.xhtml / | /navigation | | navigation from-action=#{identity.login} | rule if=#{identity.loggedIn} | redirect view-id=/dashboard.xhtml/ | /rule | /navigation | | /page | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4125184#4125184 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4125184 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: [NEWBIE Q] redirecting to a certain page if already logg
How your pages.xml login page is configured? Does it have login-required=false? like: | page view-id=/login.xhtml action=#{identity.login} login-required=false | navigation from-action=#{identity.login} | rule if=#{identity.loggedIn} | redirect view-id=/home.xhtml/ | /rule | /navigation | /page | BTW, you can invoke to any action you want when the page is loaded and then use the rules in order to forward to any page you want. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4124942#4124942 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4124942 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: s:message and the clientId
Define the label attribute in your input component. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4094875#4094875 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4094875 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Discussion: FlushModeType.NONE ?
org.jboss.seam.annotations.FlushModeType | @Begin(flushMode = FlushModeType.MANUAL) | public String myaction() { | | } | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4089308#4089308 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4089308 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: org.hibernate.exception.GenericJDBCException: Cannot ope
wise_guybg wrote : | I have been dealing with a similar problem in a previous project at work where we used Hibernate. The solution was to create a backing session that will help you recover gracefully in case of DBException/ContraintViolation. | | I was wondering if something similar can/should be done in Seam/EJB3. Sure, you can. My experience as code (a simple example): ACTION: | @Name(userAction) | @Scope(ScopeType.CONVERSATION) | public class UserAction { | | @In(required = false) | @Out(required = false) | private User user; | | @In(create = true) | protected UserService userService; | | @End | public String create() { |try { | | userService.create(user); | addCreatedMessage(); | return Outcome.SUCCESS; | } catch (EntryDuplicatedException e) { | addDuplicatedMessage(); | return null; | } | } | } | SERVICE: | | @Stateful | @Name(userService) | @Scope(CONVERSATION) | public class UserServiceBean implements UserService { | | | @In(value=#{entityManager}) | private EntityManager em; | | | public void create(User entity) throws EntryDuplicatedException { | try { | em.persist(entity); | em.flush(); | } catch (EntityExistsException e) { | throw new EntryDuplicatedException(); | } | } | | } | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4086078#4086078 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4086078 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: org.hibernate.exception.GenericJDBCException: Cannot ope
EntryDuplicatedException is a custome exception I have: | | @ApplicationException(rollback = true) | public class EntryDuplicatedException extends Exception { | | public EntryDuplicatedException() { | } | | } | addDuplicatedMessage() is just a simple method to add the error message to the view (FacesMessages..) Finally, you should use @TransactionAttribute(REQUIRES_NEW) for the especific method you want to recover after the transaction fails: | @TransactionAttribute(REQUIRES_NEW) | public void update(User entity) throws ConcurrencyException, EntryDuplicatedException { | try { | em.merge(entity); | em.flush(); | } catch (EntityExistsException ee) { | throw new EntryDuplicatedException(ee); | } | } | | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4086131#4086131 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4086131 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Recovering from a Constraint violation exception
I do use a Action + Service pattern in order to catch all EJB/JPA exceptions and stay in the same page or display a pretty nice error messages. The action is a simple POJO and the Service is an @EJB , @TransactionAttribute(REQUIRES_NEW) over the method makes me happy in this case. IIRC, I've already post in this forum how I'm doing (time ago). HTH. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4085551#4085551 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4085551 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: required=true validation messages
Have you tried the label attribute in your input component (JSF 1.2)? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4084671#4084671 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4084671 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Invoking a Seam component method from pages.xml?
I think you should use a page action. | page view-id=/admin/userList.xhtml action=#{userList.reload} | /page | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4081724#4081724 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4081724 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: problem with Authenticator
AFAIK, you can't use @EJB in POJO components. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4081428#4081428 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4081428 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: renew the @Factory
See all my comments here, this maybe can help you. http://www.jboss.com/index.html?module=bbop=viewtopict=117469 View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4081461#4081461 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4081461 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: please help me out of this problem
Yes, you're right, user is stateless, but take a look what return initUser method. It returns the reference to the instance variable user. So, this should work: | private User user; | public void saveCurrentUser() { | userDao.update(user); | } | BTW, I improved a bit my last example (avoiding several loading roundtrip): | | @Stateful | @Name(userRegister) | @Scope(ScopeType.SESSION) | public class UserRegisterAction implements UserRegister { | | private Log logger = LogFactory.getLog(UserRegisterAction.class); | | private User user; | private String selectedUsername = 0; | private boolean reload; | | | | @Factory(value = user, scope = ScopeType.STATELESS) | public User initUser() { | if(selectedUsername.equals(0)){ | logger.debug(new user); | user = new User(); | }else{ | logger.debug(edit:+ selectedUsername); |if(reload) { | user = userDao.load(selectedUsername); | reload = false; | logger.debug(test:+ user.getUsername()); | } | } | return user; | } | | public void userListValueChanged(ValueChangeEvent event) { | | try { | selectedUsername = (String) event.getNewValue(); | reload = true; | | } catch (Exception e) { | e.printStackTrace(); | } | } | | } | } | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4080477#4080477 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4080477 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: please help me out of this problem
Did you try it? Because I have the same case (I wrote) working in my application. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4080489#4080489 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4080489 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: please help me out of this problem
Also take into account the last change I did regarding the reloading of the user, because if a new instance of the same user is reloaded every time, then you don't expect to have the same reference instance variable updated. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4080492#4080492 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4080492 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: please help me out of this problem
Yes your'e right. STATELESS @Factory means it will be called every time the name is referenced in the page. In this case returning the already instantiated class. And yes, the value change listener is invoked when the value is changed in the selectbox, enabling the @Factory method to reload with the new username. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4080696#4080696 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4080696 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: please help me out of this problem
I would use a @Factory. Java: | | @Stateful | @Name(userRegister) | @Scope(ScopeType.SESSION) | public class UserRegisterAction implements UserRegister { | | private Log logger = LogFactory.getLog(UserRegisterAction.class); | | private User user; | private String selectedUsername = 0; | | | | @Factory(value = user, scope = ScopeType.STATELESS) | public User initUser() { | if(selectedUsername.equals(0)){ | logger.debug(new user); | user = new User(); | }else{ | logger.debug(edit:+ selectedUsername); | user = userDao.load(selectedUsername); | logger.debug(test:+ user.getUsername()); | } | return user; | } | | public void userListValueChanged(ValueChangeEvent event) { | | try { | selectedUsername = (String) event.getNewValue(); | | } catch (Exception e) { | e.printStackTrace(); | } | } | | } | | Facelet: | h:panelGroup id=exportUser | h:outputLabel id=Username | h:inputText value=#{user.username}/ | | h:outputLabel id=Whatever | h:inputText value=#{user.whateverProperty}/ | | h:outputLabel id=userL value=#{bundle['userDefination.group']} for=groupMenu / | t:selectOneMenu id=userMenu required=false value=#{userRegister.selectedUsername} | valueChangeListener=#{userRegister.userListValueChanged} onchange=submit(this) | f:selectItem itemLabel=New User ... itemValue=0 / | f:selectItems id=userList value=#{userRegister.allUsers} / | /t:selectOneMenu | /h:panelGroup | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4080334#4080334 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4080334 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: JSF or Seam Question?
I will be great to have this in Seam UI. Thanks. JIRA issue added: http://jira.jboss.com/jira/browse/JBSEAM-1893 View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4080335#4080335 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4080335 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: resource not registered org.richfaces.renderkit.images.T
BTW, if you want to know the causes check the following link out: http://www.jboss.com/index.html?module=bbop=viewtopict=107897postdays=0postorder=ascstart=20#4051281 The problem is currently solved in RichFaces 3.1.0 http://jira.jboss.com/jira/browse/RF-401 View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4079996#4079996 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4079996 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: UnsupportedOperationException when using h:selectManyLis
try this: | | if(!entityManager.contains(exam)) | entityManager.merge(exam) | | HTH. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4079219#4079219 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4079219 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Can I define some
I have somethig like this: | | component name=sysConfig auto-create=true class=com.myapp.SystemConfig scope=APPLICATION | property name=rowsPerPage5/property | property name=fileUrlwhateverpath/property | /component | | | | @In | SystemConfig sysConfig; | | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4079221#4079221 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4079221 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: can not access a member of class ... with modifiers
Do you have defined such method in the business interface? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4079362#4079362 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4079362 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: can not access a member of class ... with modifiers
So, it seems something related with some properties' modifiers. I saw something related here: http://www.jboss.com/index.html?module=bbop=viewtopict=114028 View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4079415#4079415 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4079415 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Layering the code in Seam
Yes, magoicochea is absolutely right. By instance, my application is using ACTION + DAO layers. Actions are Seam POJOs and DAOs are Session Beans (EJB). BTW, you can take a look to wiki example in the Seam distribution, it uses action + DAO on POJO components (maybe you want something like that). HTH. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4077851#4077851 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4077851 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: How to use EntityManager for SELECT COUNT(1)?
If you're trying to execute an SQL (not JPA QL), just try with this: | int rowCnt= (Integer) em.createNativeQuery(SELECT count(1) FROM TableA).getSingleResult(); | HTH. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4074625#4074625 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4074625 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Hibernate Exception
How your JPA QL for batch update looks like? (post code) View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4073525#4073525 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4073525 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Seam + Ajax4JSF
If you are using a conversation you can start it using manual flush mode. | @Begin(flushMode = FlushModeType.MANUAL) | public String select(User instance) { |user = em.find |return result; | } | | | @End | public String create() { | em.merge(user); | em.flush(); | return result; | } | | | HTH. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4073637#4073637 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4073637 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: validation
I see three options: A) To catch the Exception in your code and then show the respective message. | public void create(Object entity) throws MyDuplicatedException { | try { | em.persist(entity); | em.flush(); | } catch (EntityExistsException e) { | throw new MyDuplicatedException(); | } | } | | B) To use @Validator and @Name enabling a JSF Validator as Seam component. | @Name(equalValidator) | @Validator | public class EqualValidator implements javax.faces.validator.Validator { | ... | public void validate(FacesContext facesContext, UIComponent uiComponent, Object value) throws ValidatorException { | ... | } | } | | | -- | | h:inputSecret id=confirmPassword value=#{user.confirmPassword} required=true |maxlength=40 redisplay=true tabindex=3 styleClass=input | f:validator validatorId=equalValidator/ | /h:inputSecret | | C) To implement custom Hibernate Validator (it will work with s:validate). | public class MyEmailValidator implements ValidatorMyEmail { | ... | public boolean isValid(Object value) {... | } | ... | } | - | | @Documented | @ValidatorClass(EmailValidator.class) | @Target({METHOD, FIELD}) | @Retention(RUNTIME) | public @interface MyEmail { | String message() default {validator.email}; | } | | | | . | @Entity | public class User { | ... | @MyEmail | private String email; | ... | } | | I used A) and B) and C) in different scenarios, but at the moment I din't use C) to access database querying for some data. Maybe you can try making MyEmail class a Seam component (which will allows you to access SMPC). HTH. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4073378#4073378 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4073378 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: entity-query : resultCount problem with join fetch
[EMAIL PROTECTED] wrote : no, there is no JIRA issue for this Now there's one: http://jira.jboss.org/jira/browse/JBSEAM-1786 Thanks. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4073382#4073382 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4073382 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Entity Bean and Jboss seam
User @Transient on your property. | @Transient | private String situation; | or: | | private transient String situation; | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4072600#4072600 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4072600 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Seam 2.0.0.BETA1, transaction:ejb-transaction and SeamTe
Done: http://jira.jboss.org/jira/browse/JBSEAM-1771 Thanks. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4071641#4071641 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4071641 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: resource not registered org.richfaces.renderkit.images.T
Try Pressing Ctrl+F5 in your browser. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4067952#4067952 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4067952 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: h:selectManyCheckbox replaces PersistentBag with Arrays.
Seems related to this: http://www.jboss.com/index.html?module=bbop=viewtopict=49 HTH. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4059610#4059610 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4059610 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Page parameter and returnToCapturedView
Can anyone point me out? Please. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4059776#4059776 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4059776 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - transaction:ejb-transaction/ and SeamTest
I just migrated my application from Seam 1.2 to Seam 2.0.0.BETA1 using Tomcat 6 and Embedded Jboss, it works like a charm. But, when I tried to execute the test suites I got the following exceptions: | uildfile: D:\Fer\srcEjemplos\Seam\seam2gen\build.xml | compiletest: | copytestclasses: | buildtest: | [copy] Copying 1 file to D:\Fer\srcEjemplos\Seam\seam2gen\test-build\META-INF | [copy] Copying 1 file to D:\Fer\srcEjemplos\Seam\seam2gen\test-build | test: |[testng] [Parser] Running: |[testng] D:\Fer\srcEjemplos\Seam\seam2gen\test-build\seam2Test.xml |[testng] WARN 30-06 21:28:38,824 (UnifiedLoaderRepository3.java:addClassLoader:675) -Tried to add non-URLClassLoader. Ignored |[testng] WARN 30-06 21:28:40,590 (TxControl.java:clinit:266) -[com.arjuna.ats.arjuna.coordinator.TxControl_1] - Name of XA node not defined. Using -37c5b421:885:46870348:0 |[testng] WARN 30-06 21:28:44,809 (JDBCPersistenceManager.java:start:143) - |[testng] JBoss Messaging Warning: DataSource connection transaction isolation should be READ_COMMITTED, but it is currently NONE. |[testng] Using an isolation level less strict than READ_COMMITTED may lead to data consistency problems. |[testng] Using an isolation level more strict than READ_COMMITTED may lead to deadlock. |[testng] ERROR 30-06 21:28:56,106 (SeamPhaseListener.java:afterPhase:189) -uncaught exception |[testng] java.lang.IllegalStateException: Could not commit transaction |[testng] at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:589) |[testng] at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:325) |[testng] at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:226) |[testng] at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:184) |[testng] at org.jboss.seam.mock.BaseSeamTest$Request.applyRequestValuesPhase(BaseSeamTest.java:666) |[testng] at org.jboss.seam.mock.BaseSeamTest$Request.emulateJsfLifecycle(BaseSeamTest.java:547) |[testng] at org.jboss.seam.mock.BaseSeamTest$Request.run(BaseSeamTest.java:487) |[testng] at com.mydomain.sean2gen.test.LoginTest.testLogin(LoginTest.java:77) |[testng] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) |[testng] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) |[testng] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) |[testng] at java.lang.reflect.Method.invoke(Unknown Source) |[testng] at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:604) |[testng] at org.testng.internal.Invoker.invokeMethod(Invoker.java:470) |[testng] at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:564) |[testng] at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:830) |[testng] at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) |[testng] at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) |[testng] at org.testng.TestRunner.runWorkers(TestRunner.java:678) |[testng] at org.testng.TestRunner.privateRun(TestRunner.java:624) |[testng] at org.testng.TestRunner.run(TestRunner.java:495) |[testng] at org.testng.SuiteRunner.runTest(SuiteRunner.java:300) |[testng] at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:295) |[testng] at org.testng.SuiteRunner.privateRun(SuiteRunner.java:275) |[testng] at org.testng.SuiteRunner.run(SuiteRunner.java:190) |[testng] at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:792) |[testng] at org.testng.TestNG.runSuitesLocally(TestNG.java:765) |[testng] at org.testng.TestNG.run(TestNG.java:699) |[testng] at org.testng.TestNG.privateMain(TestNG.java:824) |[testng] at org.testng.TestNG.main(TestNG.java:802) |[testng] Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.transaction.transaction |[testng] at org.jboss.seam.Component.newInstance(Component.java:1853) |[testng] at org.jboss.seam.Component.getInstance(Component.java:1756) |[testng] at org.jboss.seam.Component.getInstance(Component.java:1735) |[testng] at org.jboss.seam.Component.getInstance(Component.java:1712) |[testng] at org.jboss.seam.Component.getInstance(Component.java:1707) |[testng] at org.jboss.seam.transaction.Transaction.instance(Transaction.java:96) |[testng] at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:576) |[testng] ... 29 more |[testng] Caused by: javax.naming.NameNotFoundException: EjbTransaction not bound |[testng] at org.jnp.server.NamingServer.getBinding(NamingServer.java:542) |[testng] at
[jboss-user] [JBoss Seam] - Re: Scary, scary thing: browser cache + Ajax4JSF???
First, this is a Ajax4JSF issue. You can see in the following link my intents to try A4J guys take this into account, but it seems I'm one in a million, and they don't care about this. http://www.jboss.com/index.html?module=bbop=viewtopict=107897postdays=0postorder=ascstart=20#4051281 Maybe if there are more people caring about this they can hear our suggestions or may be propose a better one. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4058764#4058764 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4058764 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Scary, scary thing: browser cache + Ajax4JSF???
Ok, thanks. I also encourage people of this forum who is using Ajax4JSF to make a crowd and help to improve this small but critical issue for production systems. Thanks. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4058803#4058803 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4058803 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Scary, scary thing: browser cache + Ajax4JSF???
That's great! Sure, I just vote for it. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4058917#4058917 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4058917 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: ResourceNotFoundException after Seam 2.0 upgrade
Remove your browser cache: Ctrl+F5 or F5 View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4058498#4058498 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4058498 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Page parameter and returnToCapturedView
Hi. I have page parameter registered with a converter which encrypts and decrypts the value, something like this: | page view-id=/admin/user.xhtml | param name=id value=#{userAction.id} converter=#{cipherConverter.forLong}/ | /page | I also have registered the following in components.xml: | event type=org.jboss.seam.notLoggedIn | action expression=#{redirect.captureCurrentView}/ | /event | event type=org.jboss.seam.postAuthenticate | action expression=#{redirect.returnToCapturedView}/ | /event | I have the following scenario: 1.- Log in. 2.- In the user list copy one of the urls with the page param encrypted: http://localhost:8080/myapp/admin/user.jsf?id=x5JyJWpACE4* 3.- Log off the application (I'm forcing this, but it supposes the session expired). 4.- Copy the url of the point 2. into the browser address bar, and hit enter. 5.- cipherConverter is called, specifically the getAsObject of the converter is called. Of course this method will convert the encrypted id to Long. 6.- The Login form is called, I write the account info and then log in. 7.- Immediately cipherConverter is called again. The getAsObject of the converter is called, but the value passed is the decrypted by the point 5. In this point I will always get an exception because the getAsObject expects an encrypted string, but the value passed in is an decrypted string (the long as string). Is the execution of the point 5 right? Why is invoking the converter first and then capturing the decrypted param? Is there a way I can follow to get this working fine? Thanks in advance for your help. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4057940#4057940 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4057940 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: the never ending flow of optimistic locking questions
I dealt with this time ago. Here you can find a topic related (whether it's of your interest): http://forum.hibernate.org/viewtopic.php?t=969898 After several tries I figured out that the only way (at least for me) to have this working is to have a POJO action and a SFSB DAO. POJO action and SFSB DAO are conversational, but the things that makes the difference are: * Action must not have the SMPC. * The SMPC must be in the SFSB and your update method must be marked (as you did) with TransactionAttributeType.REQUIRES_NEW. With this when the update fails you can read with the same EM (SFSB is requires). This works for me, and I think it is a good approach. Example of use: I start a, at the same conversation trying to edit a contact in its formtime (wherever located) other user opens to edit the same contact, user A saves fine its changes, but when user B tries to save, he is notified (in the same form) that someone else changes its data, and of course such data is displayed in the form. HTH. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4055817#4055817 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4055817 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: DataModel refresh
Have you tried a page action to reset the componentLayoutList when the page is load? Something like this: | | page view-id=/admin/actions/componentlayout/list.xhtml action=#{componentLayoutListAction.reset} | /page | | HTH View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4055040#4055040 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4055040 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Greate thanks to Jboss team and Jboss-Seam team especial
+1 View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4054767#4054767 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4054767 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Problems setting up Seam-managed persistence context
Have you configured your jta-data-source/ name of your persistence.xml in the jboss-beans.xml? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4054852#4054852 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4054852 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Problems setting up Seam-managed persistence context
Yes, it was I meant. You are right if @PersistenceContext is working fine, it seems the problem is with some configuration (components.xml) or component declaration. Could I see your components.xml configuration and also the whole class (component) where you are trying to inject the the EntityManager in. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4054871#4054871 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4054871 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Seam 1.3.0.ALPHA UI example doubt
I lost a lot of time trying to find out the reason for the problem I described here: http://www.jboss.com/index.html?module=bbop=viewtopict=110611 (Problem of UnsupportedOperationException when using @ManyToMany and s:convertEntity/) I tried a lot of things (debug, simplify my code, with EJB, with POJO) but I did not found the reason. Well I do the following in order to show you the problem, and maybe you can tell me what is happening: a) I have got Seam 1.3.0.ALPHA b) I check UI example has the right enviroment I want to test (@ManyToMany between Person and Colour). c) I deployed it to Jboss 4.2.0.GA and all work fine. Note that s:selectItems sample uses Seam Framework. d) I made a POJO action component in the UI example, it looks like: | @Name(personAction) | @Scope(ScopeType.CONVERSATION) | public class PersonAction { | | @In(create=true) | private EntityManager entityManager; | | private Person person; | | private Integer id; | | | @Transactional | public String update() { | entityManager.joinTransaction(); | entityManager.merge(person); | entityManager.flush(); | return Success; | } | | public Person getInstance() { | if (person != null) { | return person; | } else { | entityManager.joinTransaction(); | person = entityManager.find(Person.class, id); | return person; | } | } | | public Integer getId() { | return id; | } | | public void setId(Integer id) { | this.id = id; | } | | } | e) I created a selectItemsAction.xhtml based on selectItems.xhtml, it looks like: | h:form | | s:decorate template=decorateField.xhtml | ui:define name=labelFavourite Colours/ui:define | ui:define name=descriptionA colour is an entity/ui:define | h:selectManyListbox value=#{personAction.instance.favouriteColours} | s:selectItems value=#{colours.resultList} var=colour label=#{colour.name} / | s:convertEntity / | /h:selectManyListbox | /s:decorate | | h:commandButton value=Apply action=#{personAction.update} | s:conversationPropagation type=join / | /h:commandButton | | h:messages globalOnly=true / | ps:link view=/index.xhtml propagation=endBack to index/s:link/p | /h:form | | f) Minor changes: pages.xml | page view-id=/selectItemsAction.xhtml | begin-conversation join=true/ | param name=personId converterId=javax.faces.Integer value=#{personAction.id} / | /page | template.xhtml (link to start the update process, exactly like selectItems): | lis:link view=/selectItemsAction.xhtml propagation=join | codes:selectItems POJO Action/code | f:param name=personId value=1 / | /s:link/li | g) I just deploy again and trying selectItemsAction.xhtml it does not work, it gives UnsupportedOperationException (stacktrace is in the post I put at the beginning of this post) . Now, my question is why POJO action which I added to UI example does not work? What am I doing wrong? As I tell you before, this also does not work using EJB(my case), and this only happens with Seam 1.3.0.ALPHA, because it works fine in Seam 1.2.1. And as I tell above, it works with Seam Framework. Please help me, at this time I don't know how to solve this. Thanks in advance. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4054937#4054937 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4054937 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Seam on tomcat functionality
Actually I have a Seam application running on Tomcat using Ajax4JSF and RichFaces. So, what I recomend you to start is to go into booking seam example folder, open an console and type ant deploy.tomcat (you need to have configured your build.properties for tomcat home). View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4053956#4053956 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4053956 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Session problems
You can use a page action to refresh your list (when using SESSION scope). Like this: | Stateful | @Scope(ScopeType.SESSION) | @Name(partsListFinder) | public class PartsListFinderBean implements PartsListFinder { | @In(required=false) | private String plName; | | @DataModel | private ListPartsList partsLists; | | @PersistenceContext(type=PersistenceContextType.EXTENDED) | private EntityManager em; | | public void findPartsList() { | partsLists = em.createQuery(from PartsList pl where pl.name like :name) |.setParameter(name, plName + '%') |.getResultList(); | } | | @Factory(partsLists) | public void findPartsLists() { | partsLists = em.createQuery(from PartsList).getResultList(); | } | public void reload(){ | partsList = null; | } | @Destroy @Remove | public void destroy() { } | } | Pages.xml: | page view-id=/PartsList.xhtml action=#{partsListFinder.reload} | /page | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4053582#4053582 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4053582 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Session problems
I don't understand you very well, nevertheless I avoided the LazyInitializationException using SMPC and this in my faces-config: | | lifecycle | phase-listenerorg.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener/phase-listener | /lifecycle | | | | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4053632#4053632 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4053632 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Beginner Question
At first glance I can see one wrong thing, your entity component name is LoginAccount, so if you want to biject it, you should declare it as follows: | @In @Out | public LoginAccount LoginAccount; | or | @In(value=#{LoginAccount}) @Out(value=#{LoginAccount}) | public LoginAccount LoginAccount; | BTW, check whether your interface has the correct methods corresponding to component it is implementing it. HTH. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4053638#4053638 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4053638 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Beginner Question
Typo in the second option I mentioned, it should be: |@In(value=#{LoginAccount}) | @Out(value=#{LoginAccount}) | public LoginAccount account; | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4053648#4053648 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4053648 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Seam, Facelets, JSF and XML comments
Actually, it is not a seam issue, it is a Facelets behaviour, you can avoid it adding below configuration in your web.xml | context-param | param-namefacelets.SKIP_COMMENTS/param-name | param-valuetrue/param-value | /context-param | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4053302#4053302 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4053302 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Issue when upgrading to Seam 1.3.0.ALPHA (CVS)
Hi, Using Seam 1.2.1 I had a relationship like: | //User Entity. | @ManyToMany(fetch = FetchType.LAZY) | @JoinTable( | name = userrole, | joinColumns = @JoinColumn(name = userid), | inverseJoinColumns = @JoinColumn(name = roleid) | ) | @OrderBy(name asc) | private ListRole roles; | And my respective page fragment for create/update such relationship was: | s:decorate template=/include/inputField.xhtml | ui:define name=label#{messages['User.assignRoles']}/ui:define | h:selectManyCheckbox value=#{user.roles} id=userRoles tabindex=13 styleClass=checkBox | s:selectItems value=#{rolesQuery.resultList} var=role label=#{messages[role.description]}/ | s:convertEntity / | /h:selectManyCheckbox | /s:decorate | | Creating and updating user's roles was working well using seam 1.2.1. Yesterday I decided to upgrade my applicationt to Seam 1.3.0.APLHA, everything works fine except roles updating (creation works fine). I mean, if I create a user with 2 roles, then I open same user to edit it and I add or remove a role and then save the changes I get an java.lang.UnsupportedOperationException (I will put the stacktrace bottom). I think this is not the UnsupportedOperationException most people deal with it when migrating to JBoss 4.2. Application loads fine, works everywhere except this specific case I mentioned. -I checked every library in Seam and compare them with my app libraries in order to avoid any mistake. -I am sure I have my configuration files pointing 1.3 version. -My web.xml is fine. My application is running fine with Seam 1.2.1 (I did a backup), so I don't know what the problem could be, I guess it is something with JSF 1.2 RI or SEAM, but I'm not sure because I had to update both at same time (seam now uses JSF RI 1.2 as default) . Even I made an small test case (only the affected classes and operations without A4J or RichFaces support) in order to know if I was doing something wrong in my code (But I didn't touch anything before upgrading), but even in this test case I get the same error. I test it in JBoss 4.2.GA and Tomcat 6.0.13. Please help, Thanks in advance. Stacktrace: | javax.faces.FacesException: #{userAction.update}: /admin/user.xhtml @165,120 action=#{userAction.update}: javax.ejb.EJBEx | ception: java.lang.UnsupportedOperationException | at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:105) | at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251) | at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117) | at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244) | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) | at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) | at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:64) | at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55) | at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:60) | at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55) | at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:81) | at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55) | at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:47) | at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55) | at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127) | at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277) | at org.jboss.seam.web.AbstractAjax4jsfFilter.doFilter(AbstractAjax4jsfFilter.java:35) | at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:55) | at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:126) | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) | at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228) | at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) | at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433) | at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) | at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
[jboss-user] [JBoss Seam] - Re: Issue when upgrading to Seam 1.3.0.ALPHA (CVS)
[EMAIL PROTECTED] wrote : What is the class of the List that throws UOE? Use your debugger to find out. | After debugging I saw that the UOE is thrown by the class org.hibernate.type.CollectionType, in the method replaceElements. | ... | java.util.Collection result = ( java.util.Collection ) target; | result.clear(); //just here | ... | When debugging I also saw that the collection is an ArrayList that has the correct value. I researched about possibles causes and it seems the most probable reason for this exception is that the ArrayList to be clear is unmodifiable, but I don't know why! Related UOE topic: http://forum.java.sun.com/thread.jspa?threadID=700412 [EMAIL PROTECTED] wrote : | BTW, this is definitely not a Seam problem. | The debugging tells the exception is thrown by Hibernate, but it really does not involve it is the problem. Specially because hibernate libraries (bundled in seam) are the same in 1.3 and 1.2.1 version (so, nothing has changed), even I did upgrade to latest Hibernate libs and I got the same exception. I'm really stuck with this, hope someone can give me some hints regarding this, in the meantime I will go back to Seam 1.2.1, where all works fine (but I would like to use the upcoming 1.3). Any help would be appreciated. Thanks for your time. If someone wants to see this problem running, as I said before I have a test case for JBoss 4.2.GA and tomcat 6.0.10. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4052969#4052969 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4052969 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: GF with Seam 1.3 - Caused by: java.lang.UnsupportedOpera
trouby wrote : anonymous wrote : | | Remove the expression language factory thing in faces-config.xml | | | | Remove what? I don't think I have anything related to EL factory, | | I only have seam's el-resolved and the phase-listener life cycle, | | | Thanks Remove the el-resolver/ tag from your faces-config.xml View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4051710#4051710 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4051710 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: GF with Seam 1.3 - Caused by: java.lang.UnsupportedOpera
- You should update the XML namespace for your configuration files to 1.3. - Your web.xml pointed to web-app_2_5.xsd - If you are suing Ajax4JSF you must change the VIEW_HANDLER as follows: | context-param | param-nameorg.ajax4jsf.VIEW_HANDLERS/param-name | param-valuecom.sun.facelets.FaceletViewHandler/param-value | /context-param | And the Filter for Ajax4JSF is no longer needed, SeamFilter adds it. - The com.sun.faces.config.ConfigureListener in web.xml is no longer needed. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4051732#4051732 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4051732 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Latest CVS EntityQuery troubles/doubts
Hi. I've updated to latest SEAM CVS (20070602), the improvements are good. Nevertheless I have some questions/doubts: A) The method isNextExists() always returns false. I made some debug and I found that isNextExits() method is called before than getResultList() (I'm sure it is related with some JSF Phase behaviour), this means the value of resultList property will always be null. I resolved this making this change: | @Override |@Transactional |public boolean isNextExists() |{ | return getResultList()!=null | resultList.size() getMaxResults(); |} | I'm sure you guys have a better solution... B) Is it possible to have a EntityQuery in the SESSION scope? I tried to do it. But it does not work (EntityManager is closed exception is thrown). I think there is some reason behind it, can you make me figure it out? C) Can I use DataModelSelection when using EntityQuery? What I want to have is something like: | rich:dataTable value=#{userList.dataModel} var=userItem id=userListId | rows=#{userList.maxResults} | | rich:column | f:facet name=header#{messages['Common.action']}/f:facet | s:link value=#{messages['Common.view']} action=#{userAction.select(userItem)}/ | /rich:column | | | /rich:dataTable | At this time I can use #{userAction.select(userItem)} only if I have a component which explicitly use @DataModel annotation. But it would be nice to have this out-of-the-box on entity-query. Thanks in advance. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4050773#4050773 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4050773 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: migration concerns. Seam 1.3 + Jboss 4.2 +?
AFAIK, since Tomahawk 1.1.3 you can use it in any JSF implementation. So I think you can use it with JSF RI. The only thing you need to care about is that Tomahawk 1.1.3 is for JSF 1.1, and Seam 1.3 will use JSF 1.2, this means you could also need to have a Tomahawk version which is compliant with JSF 1.2 (See Myfaces site). HTH. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4050487#4050487 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4050487 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: ManyToMany with EntityManager in flush mode manual
torsty wrote : forgot to say: when I used fluh mode manual I flushed before persisting. Don't you think this is the cause of your problem? You should call em.flush() explicitly after all interactions with EM are performed. I have a same scenario with User-Role (ManyToMany) relationship using SMPC with FlushModeType=MANUAL, and it is working well. HTH. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4049333#4049333 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4049333 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: stupid question about message
mnrz wrote : Hi | | When I log in using seam Authenticator, a message Welcome user_name will be displayed | | I can't find that message in any resource bundle. I want to display another message with related language that user specified how can I remove that message :)) | | I am using Seam v1.1.6 | thanks Seam adds a default message for this kind of stuff. Of course if you don't like this you can override as follows in your messages.properties: a) No message after login: | org.jboss.seam.loginSuccessful | b) As you like message: | org.jboss.seam.loginSuccessful = Welcome, #0 | HTH. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4049341#4049341 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4049341 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Problem about EntityManager.
You have declared SMPC as entityManager, then you should use as follows: | @In | EntityManager entityManager; | or (if you prefer): | @In(#{entityManager}) | EntityManager em; | or: | @In(value=#{entityManager}) | EntityManager em; | HTH. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4049430#4049430 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4049430 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Domain model duplicates validation
Hi. anonymous wrote : | But in some weird case where my validation require some kind of twisted logic using some properties from the Person entity and all the other entities already persisted, is there a clean way to add this logic in the model? Or this is conceptually wrong? | For me, putting validation logic in your model is nasty. And it's conceptually wrong. If you want to validate something related to one or several entities, and you don't have another way to do it (according your requirements) then you should perfom such validation in your controller (SLSB or SFSB). The example I gave you it was recently adopted by me for validate duplicates for an entity (of course when the properties are not the @Ids). Time ago I was doing this validation in a session bean, something as follows: | public void persis(Person entity){ | | try { |em.createQuery(select p from P where p.lastName=:lastName and | p.firstName = :firstName).setParameter(lastName, | entity.lastName).setParameter(firstName, | entity.firstName).getSingleResult(); | | //user exists, then throw some AlreadyExistException. | } catch (NoResultException e) { | em.persist(entity); | } | | } | But the above code involves two SQL's: | select from person ...where lastname | insert into person.. (if the above sql does not return value) | But delegating this validation to DB layer (@UniqueConstraint) the only SQL will always be: | insert into person | So, in order to reduce the DB round trip I decided to use DB approach for this case. Of course, if you are free to make changes in the database schema. I think this is total portable, because I don't know some database server that does not allow to use UNIQUE constraints. anonymous wrote : The validation you gave me works great. The only complain is that a get some error logs about: Yes, this is annoying, I ask the same time ago, see below link (I din't try it yet myself): http://www.jboss.com/index.html?module=bbop=viewtopict=98560 anonymous wrote : | Hey, i'm your neighbor! From Paraguay :D | Nice to hear it. Cheers. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4049075#4049075 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4049075 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: can't get it working: exception redirection
If you are using Facelets (.xhtml as default) | exception class=org.jboss.seam.web.FileUploadException | end-conversation/ | redirect view-id=/errors/fue.xhtml | message severity=errorFile size is above allowable maximum/message | /redirect | /exception | if you are using another view technology than Facelets then write the corresponding view-id. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4049078#4049078 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4049078 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Domain model duplicates validation
I don't know what exactly you mean with without mapping that to the database, but anyway I have solved something similar as follows: | @Entity | @Table(name = person, uniqueConstraints = @UniqueConstraint(columnNames = {firstname, lastname})) | public class Person { | @Id | private Long id; | @Column(name = firstname) | private String firstName; | @Column(name = lastname) | private String lastName; | private String address; | | public Long getId() { | return id; | } | | public void setId(Long id) { | this.id = id; | } | | public String getFirstName() { | return firstName; | } | | public void setFirstName(String firstName) { | this.firstName = firstName; | } | | public String getLastName() { | return lastName; | } | | public void setLastName(String lastName) { | this.lastName = lastName; | } | | public String getAddress() { | return address; | } | | public void setAddress(String address) { | this.address = address; | } | } | | With above, the validation is done in database layer, but it is caught by JPA and it throws a javax.persistence.EntityExistsException. It works for me in the sense I don't have to write any special login in a Session Bean to validate this. HTH. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4048884#4048884 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4048884 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: EntityHome for nested entity CRUD?
In order to avoid to have basically the same page twice, I think you can improve that in two ways: 1) Use a page composition for Edit form and pass the component instance as ui:param. 2) Declare in your pages.html alias view-id for each case but render only one page. Something like this: | | page view-id=/admin/userListing.xhtml | action execute=#{userList.refresh}/ | navigation evaluate=#{userList.wired} | render view-id=/userList.xhtml/ | /navigation | /page | | | page view-id=/admin/userListingSpecific.xhtml | action execute=#{userList.refresh}/ //do something with the action | navigation evaluate=#{userList.wired} | render view-id=/userList.xhtml/ | /navigation | /page | | With above code I can define some component variables that then I can use to render specific content inside userList.xhtml. userListing.xhtml and userListingSpecific.xhtml do not exist physically they are only declared in pages.xml. HTH. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4048760#4048760 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4048760 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: EntityHome for nested entity CRUD?
In my last post in point 2) I meant pages.xml not pages.html View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4048761#4048761 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4048761 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: @Embeddable question
Have you declared the ABC as follows?: | public class XYZ { | ... | private ABC abc = new ABC(); | | ... | getters/setters | } | | In this case abc should be referenced in the view, not ABC. HTH. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4047232#4047232 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4047232 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: why conversation-timeout doesn't work properly?
anonymous wrote : | You must be logged in to perform this action | That message tell that the HTTP Session has been timed out (session time out destroys any active conversation). How long are your http session defined? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4047234#4047234 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4047234 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: @Digit Annotation
I will really appreciate if the next release of Seam has bundled the latest Hibernate libraries (Core, EM, Validator...). There are some bugs corrected in such versions currently I'm waiting for. Thanks in advance. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4047236#4047236 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4047236 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: @Embeddable question
I make a mistake in my last post, the code shoul be: | public class XYZ { | ... | @Embedded | private ABC abc = new ABC(); | | ... | getters/setters | } | | And your ABC must have @Embeddable at type level. do you have it in this way? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4047243#4047243 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4047243 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: @Digit Annotation
Seam distribution has a hibernate-all.jar which I am currently using to deploy in Tomcat. I don't know how hibernate is distributed on JBoss AS, but I guess is not something like hibernate-all.jar. Anyway in this case it would be nice to do the upgrading also (if is not done yet) View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4047291#4047291 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4047291 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: does EJB3 support hibernate @Filter annotation..?
See http://www.jboss.com/index.html?module=bbop=viewtopicp=4045495 HTH. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4047310#4047310 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4047310 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Own HttpServlet and No application context active
Surrond SeamFilter to your Servlet. | filter | filter-nameSeam Filter/filter-name | filter-classorg.jboss.seam.web.SeamFilter/filter-class | /filter | | | filter-mapping | filter-nameSeam Filter/filter-name | url-pattern/*/url-pattern | /filter-mapping | | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4047346#4047346 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4047346 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: LazyInitializationException on SeamTest
Forget this post. It was my fault (I was using @PersistenceContext instead SMPC by accident), now it is working fine. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4046999#4046999 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4046999 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Hibernate SQL statements are not getting logged
| property name=hibernate.show_sql value=true/ | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4047023#4047023 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4047023 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Test EJB3/Seam from eclipse
Yes, you are in the right track. Seam provides a way you can do unit and integration (functional) tests. See: http://docs.jboss.com/seam/latest/reference/en/html/testing.html View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4046908#4046908 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4046908 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - LazyInitializationException on SeamTest
Hi. Somebody knows how to deal with LazyInitializationException when using Seam integration test? I got this exception: org.hibernate.LazyInitializationException. The simple test: | public class LoginTest extends SeamTest { | | @Test | public void testLogin() throws Exception { | | new FacesRequest() { | | @Override | protected void invokeApplication() { | assert !isSessionInvalid(); | assert getValue(#{identity.loggedIn}).equals(false); | } | | }.run(); | | new FacesRequest() { | | @Override | protected void updateModelValues() throws Exception { | assert !isSessionInvalid(); | setValue(#{identity.username}, fer); | setValue(#{identity.password}, fernando); | } | | @Override | protected void invokeApplication() { | invokeMethod(#{identity.login}); | } | | @Override | protected void renderResponse() { | assert getValue(#{identity.username}).equals(fer); | assert !Manager.instance().isLongRunningConversation(); | assert getValue(#{identity.loggedIn}).equals(true); | } | | }.run(); | | new FacesRequest() { | | @Override | protected void invokeApplication() { | assert !isSessionInvalid(); | assert getValue(#{identity.loggedIn}).equals(true); | } | | }.run(); | | new FacesRequest() { | | @Override | protected void invokeApplication() { | assert !Manager.instance().isLongRunningConversation(); | assert !isSessionInvalid(); | invokeMethod(#{identity.logout}); | assert Seam.isSessionInvalid(); | } | | @Override | protected void renderResponse() { | assert getValue(#{identity.loggedIn}).equals(false); | assert Seam.isSessionInvalid(); | } | | }.run(); | | } | | } | The authenticator class: | | @Name(authenticator) | public class AuthenticatorAction implements Serializable { | | private static final long serialVersionUID = -3938569313203918047L; | | @Logger | private Log log; | | @In(create = true) | private UserManager userManager; | | | @In | private Identity identity; | | public boolean authenticate() { | | try { | User currentUser = userManager.findByUsernameAndPassword(identity.getUsername(), | Hash.instance().hash(identity.getPassword())); | if (currentUser.getRoles() != null) { | for (Role role : currentUser.getRoles()) { | identity.addRole(role.getName()); | } | } | | return true; | | } catch (EntryNotFoundException e) { | return false; | } | } | | p | } | The user entity (fragment) | | @Entity | @Table(name = users) | @Name(user) | public class User implements Serializable { | ... | @ManyToMany(fetch = FetchType.LAZY) | @OrderBy(name asc) | private ListRole roles; | ... | } | Any help will be appreciated. Thanks in advance. The stacktrace: | 21:39:54,515 ERROR [LazyInitializationException] failed to lazily initialize a collection of role: com.jtp.app.domain.User.roles, no session or session was closed | org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.jtp.app.domain.User.roles, no session or session was closed | at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358) | at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350) | at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343) | at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86) | at org.hibernate.collection.PersistentBag.iterator(PersistentBag.java:246) | at com.jtp.app.action.AuthenticatorAction.authenticate(AuthenticatorAction.java:45) | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | at
[jboss-user] [JBoss Seam] - Re: Seam EL: How to get msg from resource file?
But you can do this: | ... | @In private MapString, String res; | | String label = res.get(enum.typeA.label); | or this: | ... | @In(#{res['enum.typeA.label']}) | private String label; | | HTH. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4046600#4046600 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4046600 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: JSF Composition Components with Seam
I have this in my web.xml: | context-param | param-namefacelets.LIBRARIES/param-name | param-value | /WEB-INF/facelets/myapp.taglib.xml | /param-value | /context-param | myapp.taglib.xml | ?xml version=1.0? | !DOCTYPE facelet-taglib PUBLIC | -//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN | http://java.sun.com/dtd/facelet-taglib_1_0.dtd; | | facelet-taglib | namespacehttp://my.com/jsf//namespace | tag | tag-namedataScroller/tag-name | sourcetags/dataScroller.xhtml/source | /tag | /facelet-taglib | And in the dataScroller.xhtml is located: WEB-INF/facelets/tags/dataScroller.xhtml Then in my page (located anywhere) I have: | ui:composition xmlns=http://www.w3.org/1999/xhtml; | xmlns:s=http://jboss.com/products/seam/taglib; | xmlns:ui=http://java.sun.com/jsf/facelets; | xmlns:f=http://java.sun.com/jsf/core; | xmlns:h=http://java.sun.com/jsf/html; | xmlns:a4j=https://ajax4jsf.dev.java.net/ajax; | xmlns:rich=http://richfaces.ajax4jsf.org/rich; | xmlns:app=http://my.com/jsf; | template=/layout/template.xhtml | | | app:dataScroller dataTableId=userListId/ | | | | /ui:composition | | And all is working OK. HTH. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4046135#4046135 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4046135 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: @Filter example
The reason you got that error resides here: | entity-manager-factory=#{entityManager} | Just change your second persistence context as follows: | | core:managed-persistence-context name=filteredEntityManager | auto-create=true | persistence-unit-jndi-name=java:/entityManagerFactory |core:filtersvalue#{hubFilteredChannels}/value/core:filters | /core:managed-persistence-context | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4046140#4046140 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4046140 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Invoking a (refresh) method when user select a RichFaces
Use a page action. Something like: | page view-id=userList.xhtml action=#{userListing.refresh}/ | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4046141#4046141 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4046141 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: @Create
Post some code in order to see how currently is. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4045832#4045832 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4045832 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: @Filter example
Post the page where you are setting the currentHub in the session (where you are using @Out). And also post the code where you are trying to use the entityManager you have configured in components.xml. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4045841#4045841 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4045841 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: JSF Composition Components with Seam
Post the page where you are using the composition tag. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4045836#4045836 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4045836 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Best Practise: Form / Confirm / Save | Getting current p
You should use the CONVERSATION scope and use flushMode = FlushModeType.MANUAL in the @Begin annotation, then you can explicitly call entityManager.flush() if you want yo save the data, otherwise you can do anything with the data you want to edit while you conversation is active. Regarding your second question, I don't understand what you want to do. Maybe if you explain a bit else, I can help you. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4045847#4045847 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4045847 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: JSF Composition Components with Seam
And, also tell us where is located your field.xhtml? webapp/ ? webapp/WEB-INF? ...etc. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4045839#4045839 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4045839 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: @Filter example
1.- Define the Filter in your Entity. | | @Entity | @Table(name=NODE) | @org.hibernate.annotations.FilterDef( | name = accessLevelFilter, | parameters = [EMAIL PROTECTED](name = currentAccessLevel, type=integer)} | ) | @org.hibernate.annotations.Filter( | name = accessLevelFilter, | condition = READ_ACCESS_LEVEL = :currentAccessLevel | ) | public abstract class Node implements Serializable { | ... | @Column(name = READ_ACCESS_LEVEL, nullable = false) | protected int readAccessLevel; | | ... | } | | 2.- Configure components.xml | core:filter name=accessLevelFilter | core:nameaccessLevelFilter/core:name | core:parameters | keycurrentAccessLevel/key | value#{currentAccessLevel}/value | /core:parameters | /core:filter | | core:managed-persistence-context name=restrictedEntityManager | auto-create=true | entity-manager-factory=#{wikiEntityManagerFactory} | core:filtersvalue#{accessLevelFilter}/value/core:filters | /core:managed-persistence-context | | | 3.- Set somewhere a value for #{currentAccessLevel}. | Contexts.getSessionContext().set(currentAccessLevel, bestRole.getAccessLevel()); | 4.- Finally use the filtered Persistence Context. | @Name(nodeDAO) | @AutoCreate | @Transactional | public class NodeDAO { | | // Most of the DAO methods use this | @In protected EntityManager restrictedEntityManager; | ... | public Node findNode(Long nodeId) { | restrictedEntityManager.joinTransaction(); | try { | return (Node) restrictedEntityManager | .createQuery(select n from Node n where n.id = :nodeId) | .setParameter(nodeId, nodeId) | .getSingleResult(); | } catch (EntityNotFoundException ex) { | } catch (NoResultException ex) { | } | return null; | } | | } | | Above steps are based on the Seam wiki example. If you want to see more, check it out. HTH. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4045523#4045523 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4045523 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: @Filter example
AFAIK, Wiki example is in the CVS only. Regarding class type parameter, I don't have any example and I don't know much about it. Looks like Hibernate specific stuff, so see Hibernate for this (but I guess you already did it). View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4045533#4045533 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4045533 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Injection of SESSION POJO into event/session scoped POJO
I will suggest you the following: (The reasons I do this are in the Seam reference documentation) | @Name(balance) | @Scope(EVENT) | public class Balance implements Serializable | { |private double totalMarketValue; |private double cash; |private double margin; |private String userName; |@In //it suppose the user already is in the session context (an instance) |private User user; |@Logger Log log; | |@Create |public void initialize(){ | this.setTotalMarketValue(0); |this.setMargin(0); |this.setCash(0); | this.setUserName(user.getUsername()); |} | | } | | | View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4045573#4045573 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4045573 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Injection of SESSION POJO into event/session scoped POJO
The name initialize does not matter. You can mane as you want, the most important thing here is the @Create annotation, which tells Seam to execute such method just after the component is successfuly initialized (all Seam components are available, ready to be injected). View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4045580#4045580 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4045580 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Simple question with ajax4jsf
Have you tried surrounding your input-checkbox with a4j:region? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4045043#4045043 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4045043 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: framework:entity-query class attribute
Thanks Pete, for your suggestion, nevertheless that was something I did previously. To be specific, in the extended EntityQuery I added some generic (for all lists) methods like the total pages and the current page (among others). These changes should be used for all entity-queries in my app. Now, your suggestion obliges me to create one class for every entity query and annotate it with @Name, and each class will have exactly the same methods. I think this is not a very good solution (a lot of classes only difering the @Name, even if I have a super class I will need to extend it and add a @Name for each one), and this is the reason I ask if the entity-query class attribute can be used for that purpose (to use an extended EntityQuery instead the Seam EntityQuery directly). Hope now is more clear than before, and you can point me out. Thanks in advance. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4044244#4044244 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4044244 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: framework:entity-query class attribute
Thanks Pete. I also thought in that solution. But I was afraid to loose the namespace stuff for entity-query. Now, I think this is my only chance (or define my own namespace). Only by curiosity. Do you know what is the purpose of the class attribute in the framework:entity-query stuff? I looked for it in the seam reference, but I cannot find it. Thanks. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4044287#4044287 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4044287 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: EntityQuery: showing last page with no results?
Not yet. I'm tested with max-results defined. But I din't test with no max-result (not paged) defined. And also I'm thinking about to contribute some improvements, like total pages, current page, and some other minus bugs I found. When I will have this ok, I will report the errors and suggest the improvements. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4044352#4044352 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4044352 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: Distinguishing between Error and Info FacesMessages
Have you tried this?: | h:messages globalOnly=true styleClass=message errorClass=messageError infoClass=messageInfo warnClass=messageWarn/ | HTH. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4044515#4044515 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4044515 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: EntityQuery: showing last page with no results?
If you are using the query with max-results defined, then you must to extend the EntityQuery class and override the following methods as follows: | @Override | @Transactional | public long getLastFirstResult() { | | long page = (getResultCount() / getMaxResults()) * getMaxResults(); | if (page = getResultCount()) | return page - getMaxResults(); | else | return page; | } | | @Override | public boolean isNextExists() { | return getResultList() != null | getResultCount() (getFirstResult() != null ? getFirstResult() : 0) + getMaxResults(); | } | | Looks like the above methods in the Query class does not take care about a paged result (or whatever I can't see). So, I made the above changes and all works fine. HTH. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4044147#4044147 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4044147 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - framework:entity-query class attribute
I was using entity-query, now I need to make some extensions to EntityQuery provided by Seam. I assumed that using the class atribute for the framework:entity-query I can define a subclass of the EntityQuery. Is my assumption correct? | public class MyEntityQuery extends org.jboss.seam.framework.EntityQuery { | ...some stuff | } | components.xml | framework:entity-query name=userListing ejbql=select u from User u auto-create=true max-results=5 scope=SESSION class=com.app.MyEntityQuery/ | | Above code does not work. It seems that Seam EntityQuery is used even if I declare a class attribute. One of the errors I got when adding new properties to the extended EntityQuery: | Caused by: javax.faces.el.PropertyNotFoundException: /admin/userList.xhtml @130,105 value=#{userListing.currentPage}: Bea | n: org.jboss.seam.framework.EntityQuery_$$_javassist_1, property: currentPage | at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:58) | at javax.faces.component.UIOutput.getValue(UIOutput.java:80) | at javax.faces.component.UIInput.getValue(UIInput.java:88) | at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getValue(RendererUtils.java:278) | ... 59 more | do I am misunderstanding the use of such class attribute? or is it a bug? Any ideas? View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4044159#4044159 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4044159 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JBoss Seam] - Re: javax.faces.el.EvaluationException: More than one method
Can anyone help me?, please. View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4042157#4042157 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4042157 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user