-
1. Re: 15 gotchas in seam
luxspes Nov 9, 2009 10:12 PM (in response to deanhiller2000)How about:
- Do not use EAR/EJBs if you want ZeroTurnaround, use WAR/POJOs. Read more
- Do not use JPA if you want full ZeroTurnaround
- Do not use JBossAs 4.x if you want your application to do cold restarts fast during development (for example if you decided to use JPA) (Don't know if 5.x starts faster, if it does not, revert to plain Tomcat)
- Do not use EmbeddedJBoss if you want your tests to run fast (just delete the jboss .jars from your test project and and use Spring to get to you datasource)
- Do not use JSF/Richfaces 3.x without http compression enabled because it generates a huge amount of XHML that will take a lot of time to download and your users will get angry, enable tomcat http compression, if your admin refuses to let you do it, use a filter
- Do not validate simple stuff (numeric fields, regular expressions, dates, simple comparisions between fields, etc) using seam/jsf/richfaces validation, it is very slow, and your users will not like it, use jQuery, only use seam/jsf/richfaces validation for complex business logic stuff.
- Do not trust seam-gen CRUD, the code it generates is wrong.
- If you are using Richfaces, always work with the global queue enabled it will save you lots of
could not acquire lock on @Synchronized component
headaches - If you are Richfaces global queue do not believe it is going to solve all your concurrency problems, if you need stability fast, use ConfigurableSynchronizationInterceptor with a
big
default value (around 1 minute). Read more
And those are only the ones I can think from the top of my head...
-
2. Re: 15 gotchas in seam
deanhiller2000 Nov 9, 2009 11:24 PM (in response to deanhiller2000)great additions. I just ran into a new one.
Do NOT bother using rich:comboBox with s:selectItems s:convertEntity and s:convertEnum...you are wasting your time, wait for JIRA issue.... https://jira.jboss.org/jira/browse/RF-5046 which should support it(vote on the issue too!!!) I would have used this widget for every pulldown if it worked better.
-
3. Re: 15 gotchas in seam
bashan Nov 9, 2009 11:40 PM (in response to deanhiller2000)Nice things, I especially like Francisco Peredo list.
I think maybe this list should have a better place... (maybe sticky). -
4. Re: 15 gotchas in seam
trelieux Nov 10, 2009 12:38 AM (in response to deanhiller2000)Thanks for the list guys, others and myself really appreciate it! And Franciso I really like your quote where or from whom is it from?
-
5. Re: 15 gotchas in seam
asookazian Nov 10, 2009 12:55 AM (in response to deanhiller2000)definitely sticky this thread!
-
6. Re: 15 gotchas in seam
dhcinc Nov 10, 2009 3:29 AM (in response to deanhiller2000)Nelson Mandella in his inaugural speech 1994.
-
7. Re: 15 gotchas in seam
jamesjmp Nov 10, 2009 12:09 PM (in response to deanhiller2000)Really good gotchas lists Dean, and Francisco!! Thread should be sticky and lists added to the knowledge base.
-
8. Re: 15 gotchas in seam
cash1981 Nov 10, 2009 1:03 PM (in response to deanhiller2000)Here is some of mine:
1. Force IE8 to run in IE7 mode because of bug in JSF/Seam/Facelets
<page view-id="*"> <header name="X-UA-Compatible">IE=EmulateIE7</header>
2. Remember that @WebRemote and jpdl.xml does not use your custom defined Message Bundle, it uses the default one even if you have configured to use custom in faces-config.xml. See here
3. Links of files using s:link inside seam pdf if you download and open the pdf in pdf viewer (ie adobe reader), then the servlet path will be replaced with file:///project/. You have to hardcode the a href with the servlet path together with the slink.
<s:link action="#{fileHandler.downloadById()}" value="#{file.name}" propagation="none"> <f:param name="fileId" value="#{file.id}"/> </s:link> <a href="#{servletPath.path}?fileId=#{file.id}&actionMethod=#{path.replace('/','')}%2Fstatus%2Fstatus_pdf.xhtml%3AfileHandler.downloadById()&" >download</a>
Where servletPath.path returns correct url to your server ie: http://localhost:8080/whatever
4. Hibernate does not care about ordering of your entity beans for creation of tables. So if you have create-drop in your persistence.xml and something in import.sql that requires ordering of rows in table to be correct, then you must have created the table before and not let hibernate create it for you. Link.
-
9. Re: 15 gotchas in seam
jeanluc Nov 10, 2009 7:25 PM (in response to deanhiller2000)Hi Dean,
Thanks for compiling this, I did run into some of them as well. I have some questions, though, as some of the statements require them.
Add required=false to every @In @Out attribute (or your clustering will break since there is no seam session at time of clustering)Can you be more specific? What do you mean by
the time of clustering
? When the server or the application are being started up? Or during a failover?
Do NOT use entityMgr.merge as it gets you into trouble time after time. Use if(bean.getId != null) entityMgr.persist(bean) insteadAgain, can you be more specific? I've been using merge() for many months and have had no problems once I understood how it works (which, granted, is not intuitive: the old entity is read, non-transient fields are copied into it from the updated entity then the old entity is saved).
Do make sure that s:button is in an h:form or clustering for just that button will NOT work but it will work with clustering offWhat do you mean
clustering for the button
? Load balancing of the call to the underlying session bean? The failover of the same call? -
10. Re: 15 gotchas in seam
deanhiller2000 Nov 10, 2009 9:05 PM (in response to deanhiller2000)
Add required=false to every @In @Out attribute (or your clustering will break since there is no seam session at time of clustering)if you set yours up for clustering, seam luckily replicates the session AFTER the page loads(unlike some impls which if session replication fails, your page does not load). anyways, if you have the default which is true, session replication fails on that bean constantly(stateful beans of course...not sure if it matters or not on stateless ones...it shouldn't but don't know for sure until I see it with my own eyes)
Do make sure that s:button is in an h:form or clustering for just that button will NOT work but it will work with clustering offI had an h:commandButton and a s:button on one page and we would fail one node, click the h:commandButton and it failed over successfully. The same scenario and clicking s:button however fails in a clustered environment.
Do NOT use entityMgr.merge as it gets you into trouble time after time. Use if(bean.getId != null) entityMgr.persist(bean) insteadWe have had multiple situations with merge screwing things up. One of them was this...
http://seamframework.org/Community/StaleStateExceptionAfterUpdateSuccessAndTxIsDoneAlso, this may be a good post for some other people(more a hibernate issue though I think as it would be nice if hibernate filed in the top level exception message with the details of eery getNextSQLException for you....
http://www.seamframework.org/102758.laceWe had other merge problems as well we ran into where after a merge you have a proxy but the data model(ie. someOtherBean.getchild() had the instance(and these guys are not equal!!!!) Later, if you have a list of things and the selected one is a proxy and the one in the list of items is an instance, you get dang value is not valid errors. After throwing merge away, we have never had any problems since then!!! I am sure eventually you will run into a situation ;).
-
11. Re: 15 gotchas in seam
trelieux Nov 11, 2009 12:52 AM (in response to deanhiller2000)This post should be a sticky post.
-
12. Re: 15 gotchas in seam
asookazian Nov 11, 2009 1:03 AM (in response to deanhiller2000)em.merge() is a crude operation that is not recommended (or even necessary) if you are using SMPC and HMF and as a result the PC does not close during the LRC. You should only merge() entities into the PC if they are detached. They do not become detached if you use SMPC and Hibernate manual flush. Read SiA for more on this...
sticky this thread!
oh, and what about (ab)use of (or lack thereof?) of @BypassInterceptors. Some of these comments will become historical/irrelevant for Seam 3 with the
injection
of Weld as the new Seam core (e.g. no more interceptors and no more contextual variables). -
13. Re: 15 gotchas in seam
asookazian Nov 11, 2009 1:07 AM (in response to deanhiller2000)Don't forget (ab)use of the rendered attribute in JSF tags. DAllen covers this here:
http://www.jsfcentral.com/articles/speed_up_your_jsf_app_1.html
-
14. Re: 15 gotchas in seam
swd847 Nov 11, 2009 2:30 AM (in response to deanhiller2000)I find the biggest problem is invoking an action no matter what validation failures occur without loosing all the values a user has entered, e.g. deleting a row in a data table but keeping the values for all the other rows. Solution is here.