[JBoss Seam] - PojoCache and s:selectItems Value is not valid Issue
by javalover75
I have the following snippet in a page:
| <s:decorate id="creditCardTypeDecoration" template="/layout/edit.xhtml">
| <ui:define name="label">Credit Card Type:</ui:define>
| <h:selectOneMenu value="#{customerHome.instance.creditCardType}" required="true">
| <s:selectItems value="#{userDAO.creditCardTypeList}" var="ccType" label="#{ccType.creditCardType}" noSelectionLabel="Select Type" />
| <s:convertEntity />
| </h:selectOneMenu>
| </s:decorate>
|
The userDAO has the following method:
| public List<CreditCardType> getCreditCardTypeList() throws CacheException
| {
| List<CreditCardType> creditCardType = (ArrayList<CreditCardType>)pojoCache.get( "reference", "creditCardTypeList" );
|
| if ( creditCardType == null )
| {
| creditCardType = entityManager.createQuery( "from CreditCardType creditCardType" ).getResultList();
| pojoCache.put( "reference", "creditCardTypeList", creditCardType );
| }
|
| return creditCardType;
| }
|
When the data comes from the cache in the validation of the form I get a value is not valid error.
When I use the following method all is well - however, a database call is made with all of the lookups. I have this pattern happening many times throughout the site and it is very expensive.
| public List<CreditCardType> getCreditCardTypeList() throws CacheException
| {
| return entityManager.createQuery( "from CreditCardType creditCardType" ).getResultList();
| }
|
Any help will be appreciated.
As an FYI I have tried to get this to work using the EJB3EntityTreeCache with no luck. I have the cache configured correctly with no errors, but it still goes to the database every time. Has anyone figured out how to get caching to work with a seam managed entity manager?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077886#4077886
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4077886
18Â years, 8Â months
[JBossCache] - changing name of jdbc.table.name?
by BruceSpringfield
Can we not change the name of the table used by JDBCCacheLoader?
If I change the name to anything other than 'jbosscache' then as the POJOCache is started, I get the exception :
org.jboss.cache.pojo.PojoCacheException: Failed starting org.jboss.cache.CacheException: Unable to start cache loaders
.
.
.
ORA-02264: name already used by an existing constraint
full error text :
19:00:05,369 ERROR [[Controller]] Servlet.service() for servlet Controller threw exception
org.jboss.cache.pojo.PojoCacheException: Failed starting org.jboss.cache.CacheException: Unable to start cache loaders
at org.jboss.cache.pojo.impl.PojoCacheImpl.start(PojoCacheImpl.java:262)
at com.jboss.cache.POJOCacheImpl.start(POJOCacheImpl.java:161)
at com.jboss.cache.POJOCacheImpl.(POJOCacheImpl.java:26)
at com.jboss.cache.POJOCacheImpl.cacheInstance(POJOCacheImpl.java:33)
at com.jboss.test.CacheTest.init(CacheTest.java:44)
at com.jboss.test.CacheTest.start(CacheTest.java:211)
at com.jboss.test.ControllerServlet.processRequest(ControllerServlet.java:36)
at com.jboss.test.ControllerServlet.doGet(ControllerServlet.java:18)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
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:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.jboss.cache.CacheException: Unable to start cache loaders
at org.jboss.cache.loader.CacheLoaderManager.startCacheLoader(CacheLoaderManager.java:384)
at org.jboss.cache.CacheImpl.internalStart(CacheImpl.java:733)
at org.jboss.cache.CacheImpl.start(CacheImpl.java:708)
at org.jboss.cache.pojo.impl.PojoCacheImpl.start(PojoCacheImpl.java:258)
... 27 more
Caused by: java.sql.SQLException: ORA-02264: name already used by an existing constraint
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:207)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:946)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168)
at oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatement.java:1614)
at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1579)
at org.jboss.cache.loader.AdjListJDBCCacheLoader.start(AdjListJDBCCacheLoader.java:251)
at org.jboss.cache.loader.JDBCCacheLoader.start(JDBCCacheLoader.java:248)
at org.jboss.cache.loader.CacheLoaderManager.startCacheLoader(CacheLoaderManager.java:378)
... 30 more
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077883#4077883
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4077883
18Â years, 8Â months
[JBoss Seam] - @Create not called 100% of the time
by chane
I have the following SFSB:
@Name("finder")
| @Stateful
| @Scope(ScopeType.EVENT)
| @LoggedIn
| public class ActivityGenericFinder implements IActivityGenericFinder {
|
| public ActivityGenericFinder(){
| log.fatal("CONSTRUCTING");
| }
|
| @Create
| public void initialize(){
| init();
| }
|
| protected void init(){
| AppUtils.LOG.fatal("INITING");
| }
|
| public String find(){
| ..do stuff for find...
| }
|
| public String next(){
| ... change offset ...
| find();
| }
|
| ........
|
| }
What I have noticed is the the @Create method is not always called. Here is the sequence:
- initial call to find (remember this is an Event scoped component)
* component is constructed and then @create called
- call next
* component is constructed and then @Create called
- wait for session to timeout (set to 1 minute in web.xml for testing)
- call next
* component is constructed
* component @Create is NOT called
!! Exception occurs since important stuff happens in @Create (e.g., initialize variables)
If I move my important stuff to the constructor, everything works as I expect - so I have a workaround. I just don't like it and wondering if I am doing something wrong
I am using 1.2.1p1 on JBoss 4.0.4.
Has anyone else seen this? Thoughts on what to do next?
Chris....
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077873#4077873
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4077873
18Â years, 8Â months