POJOs and createNativeQuery

We are having lots of complex sql and tonnes of tables in our schema and intend to use JPA(present system is on JDBC). We intend to lower the development time by using the native query support in JPA(createNativeQuery) and reuse the existing SQLs ; so that it plays well with UI which is on ADF.
So, I have a native query which selects some columns; and i also have a suitable entity(POJO) which maps to the columns that are fetched in the query. Note that the query fetches columns from multiple tables and hence the POJO resembles something like a value object (though in the present parlance its called as an Enitity). All is fine till here.
Now i need to group by certain columns; how should the result list be now accessed - do i need to create another entity(POJO) which maps to this structure of groupby column name(s) and its respective counts? Is this a fine(and elegant) solution; or can you think of anything else?

It depends,
SqlResultSetMapping is cool. But, I think not in your case.
If you map the values to an entity, the returned entities become managed by the persistence context.
An entity is a bit more than a single pojo, it must be defined as an entity, and must have an id.
So you must create entities for all results of your queries, so all result must have an id.
This is quite limited in JPA.
so maybe single transformator classes could be better choice.
if you can use hibernate instead of "standard jpa", you can use resulttranformator, it would be more useful in your case :)

Similar Messages

  • Datasource, POJO and java.sql.Blob

    Hello,
    is "java.sql.Blob" a valid type for a POJO datasource ?
    I declared one but I just dit not succeed in rendering its jpg picture.
    My java code is quite simple :
    ReportClientDocument reportClientDocument = new ReportClientDocument ();
    reportClientDocument.setReportAppServer(ReportClientDocument.inprocConnectionString);
    reportClientDocument.open (REPORT_NAME, OpenReportOptions._openAsReadOnly);
    // lBlob is a class which implements java.sql.Blob interface
    LPOJOData [] dataP = {new LPOJOData(new lBlob("Picture.jpg"))};
    POJOResultSetFactory factory = new POJOResultSetFactory(LPOJOData.class);
    POJOResultSet resultSet = factory.createResultSet(dataP);
    reportClientDocument.getDatabaseController().setDataSource(resultSet, "", "");
    and my POJO class :
    public class LPOJOData {          
              private java.sql.Blob zimage;
              public LPOJOData(java.sql.Blob zp){
                   this.zimage = zp;
              public java.sql.Blob getzimage(){
                   return zimage;
    The field "zimage" on the report is designed through a "field definition only" database, zimage is defined as a Blob field.
    Any clues ?
    Regards,
    Serge

    I have just found a list of the data types supported by a POJO Class :
    # boolean
    # byte
    # char
    # double
    # float
    # int
    # short
    # java.lang.Boolean
    # java.lang.Byte
    # java.lang.Double
    # java.lang.Float
    # java.lang.Integer
    # java.lang.Short
    # java.lang.String
    # java.SQL.Date
    # java.SQL.Time
    Well, java.SQL.Blob is not one of them.
    Is java.SQL_Blob will be a valid POJO type in the future ?
    Is there another way than POJO to feed a report from an in-memory datasource ?

  • Using pojos and jsf

    Hi guys
    I am trying to connect Pojos with jsf. I 've found that the problem is in the ejbs.
    I am using eclipse 3.1.1, jboss-4.0.4RC1 and myfaces.
    I think the application doesn't inicialize the context. Because all class work with servlet. I already have tested it.
    The error shows me
    0:20:29,981 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
    javax.faces.el.EvaluationException: Cannot get value for expression '#{PropiedadesBean.allProperties}'
         at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:397)
         at javax.faces.component.UIData.getValue(UIData.java:779)
         at javax.faces.component.UIData.createDataModel(UIData.java:545)
         at javax.faces.component.UIData.getDataModel(UIData.java:534)
         at javax.faces.component.UIData.getRowCount(UIData.java:103)
         at org.apache.myfaces.renderkit.html.HtmlTableRendererBase.encodeInnerHtml(HtmlTableRendererBase.java:124)
         at org.apache.myfaces.renderkit.html.HtmlTableRendererBase.encodeChildren(HtmlTableRendererBase.java:94)
         at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:319)
         at javax.faces.webapp.UIComponentTag.encodeChildren(UIComponentTag.java:343)
         at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:251)
         at org.apache.myfaces.taglib.UIComponentBodyTagBase.doEndTag(UIComponentBodyTagBase.java:55)
         at org.apache.jsp.paginas.propiedades_jsp._jspx_meth_h_dataTable_0(org.apache.jsp.paginas.propiedades_jsp:196)
         at org.apache.jsp.paginas.propiedades_jsp._jspx_meth_h_form_0(org.apache.jsp.paginas.propiedades_jsp:145)
         at org.apache.jsp.paginas.propiedades_jsp._jspx_meth_f_view_0(org.apache.jsp.paginas.propiedades_jsp:113)
         at org.apache.jsp.paginas.propiedades_jsp._jspService(org.apache.jsp.paginas.propiedades_jsp:78)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
         at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
         at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:693)
         at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:660)
         at org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:49)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
         at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
         at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
         at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
         at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
         at java.lang.Thread.run(Unknown Source)
    Caused by: javax.faces.el.EvaluationException: org.jboss.jose.db.PropiedadesBean
         at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:78)
         at org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:532)
         at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
         at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:378)
         ... 77 more
    Caused by: javax.faces.el.EvaluationException: Bean: org.jboss.jose.db.PropiedadesBean, property: allProperties
         at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:404)
         at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:71)
         ... 80 more
    Caused by: java.lang.reflect.InvocationTargetException
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:400)
         ... 81 more
    Caused by: java.lang.NullPointerException
         at org.jboss.jose.db.PropiedadesBean.getAllProperties(PropiedadesBean.java:71)
         ... 86 more
    10:20:30,001 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
    javax.faces.FacesException: Cannot get value for expression '#{PropiedadesBean.allProperties}'
         at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:421)
         at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
         at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:693)
         at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:660)
         at org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:49)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
         at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
         at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
         at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
         at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
         at java.lang.Thread.run(Unknown Source)
    Caused by: org.apache.jasper.JasperException: Cannot get value for expression '#{PropiedadesBean.allProperties}'
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
         ... 50 more
    10:20:30,022 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
    javax.faces.FacesException: Cannot get value for expression '#{PropiedadesBean.allProperties}'
         at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:421)
         at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
         at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:693)
         at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:660)
         at org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:49)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
         at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
         at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
         at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
         at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
         at java.lang.Thread.run(Unknown Source)
    Caused by: org.apache.jasper.JasperException: Cannot get value for expression '#{PropiedadesBean.allProperties}'
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
         ... 50 more
    10:20:30,032 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
    javax.faces.FacesException: Cannot get value for expression '#{PropiedadesBean.allProperties}'
         at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:421)
         at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
         at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
         at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
         at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
         at java.lang.Thread.run(Unknown Source)
    Caused by: javax.servlet.ServletException: Cannot get value for expression '#{PropiedadesBean.allProperties}'
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:693)
         at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:660)
         at org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:49)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
         at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:415)
         ... 25 moreMy jsf is that
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>propiedad</title>
    </head>
    <body>
    <f:view>
         <h:form id ="Properties">
              <h:dataTable id ="Propiedades" value="#{PropiedadesBean.allProperties}" var="prop" border="1">
                   <h:column>
                        <f:facet name="header">
                             <h:outputText value="Referencia"></h:outputText>
                        </f:facet>
                        <h:outputText value="#{prop.referencia}"></h:outputText>
                   </h:column>
                   <h:column>
                        <f:facet name="header">
                             <h:outputText value="Habitaciones"></h:outputText>
                        </f:facet>                    
                        <h:outputText value="#{prop.nHabitaciones}"></h:outputText>
                   </h:column>
              </h:dataTable>
         </h:form>
    </f:view>
    </body>
    </html>My bean is that
    import java.io.Serializable;
    import java.util.List;
    import java.util.ArrayList;
    import javax.ejb.Local;
    import javax.ejb.Remote;
    import javax.ejb.Stateless;
    import javax.faces.context.FacesContext;
    import javax.faces.el.ValueBinding;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    import javax.persistence.Query;
    @Stateless (name="propiedadesLocal")
    public class PropiedadesBean implements LocalPropiedades, Serializable {
         @PersistenceContext (unitName="test")
         private EntityManager em;
         public List <Propiedad> getAllProperties() {
              ArrayList<Propiedad> propiedades = new ArrayList<Propiedad>();
              ValueBinding beanValueBinding = facesContext.getApplication().createValueBinding("#{propiedadesBean.allProperties}");*/
              Query q = em.createQuery("From propiedades");
              for (Object o: q.getResultList()) {
                   propiedades.add((Propiedad) o);
              return propiedades; 
    }this statement doesn't work
    Query q = em.createQuery("From propiedades");
    When I put a checkpoint. I see the em variable is null.
    Here I've got only a function returns a ArrayList. This class implements the business logic.
    My another class implements the pesistence is that.
    package org.jboss.jose.db;
    import javax.persistence.*;
    import java.util.*;
    import java.io.Serializable;
    import javax.persistence.*;
    import javax.persistence.Id;
    @Entity
    @Table(name="propiedades")
    public class Propiedad implements Serializable{
         private int referencia;
         private double precio1;
         private String referenciaCliente;
         private int nHabitaciones;
         private int cuartosDeBa�o;
         private Empleado empleado;
         //static final long serialVersionUID = 1L;;
         public Propiedad(){};
         public int getCuartosDeBa�o() {
              return cuartosDeBa�o;
         public void setCuartosDeBa�o(int cuartosDeBa�o) {
              this.cuartosDeBa�o = cuartosDeBa�o;
         public int getNHabitaciones() {
              return nHabitaciones;
         public void setNHabitaciones(int habitaciones) {
              nHabitaciones = habitaciones;
         public double getPrecio1() {
              return precio1;
         public void setPrecio1(double precio1) {
              this.precio1 = precio1;
         @Id //(generate = GeneratorType.AUTO)
         @GeneratedValue
         @Column (name = "Referencia")     
         public int getReferencia() {
              return referencia;
         public void setReferencia(int referencia) {
              this.referencia = referencia;
         public String getReferenciaCliente() {
              return referenciaCliente;
         public void setReferenciaCliente(String referenciaCliente) {
              this.referenciaCliente = referenciaCliente;
         //@JoinColumn (name = "idEmpleado")
         @ManyToOne
         public Empleado getEmpleado() {
              return empleado;
         public void setEmpleado(Empleado empleado) {
              this.empleado = empleado;
    The servlet that works
    package org.jboss.jose.web;
    import javax.servlet.http.HttpServlet;
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    //import java.io.IOException;
    import org.jboss.jose.db.*;
    //import org.jboss.ejb.PropiedadesBean;
    public class PropiedadServlet extends HttpServlet {
         private LocalPropiedades propiedadesBean;
         private EmpleadosBean empleadosBean;
         protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {          
              this.mostrarPropiedades(req, resp);
         public void init() throws ServletException {
              try {
                   Context context = new InitialContext();
                   this.propiedadesBean = (LocalPropiedades) context.lookup("inmovil/propiedadesLocal/local");
                   this.propiedadesBean.addEmpleadoPropiedad("jose",1,"1",1000.00,"1000",1,1);          
              } catch (NamingException e) {
                   // TODO Auto-generated catch block
                   System.out.println(e.getMessage());
    //               e.printStackTrace();
         private void mostrarPropiedades(HttpServletRequest req, HttpServletResponse resp) throws ServletException ,IOException {
              PrintWriter out = resp.getWriter();
              for (Propiedad prop: this.propiedadesBean.getAllProperties()) {
                   out.p                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

    I think that I don't load. But I don't know where I write the below line.Than it's clear that you'll get a NullPointerException.
    But I don't know where I write the below line.
    Context context = new InitialContext();
    this.propiedadesBean = (LocalPropiedades)
    context.lookup("inmovil/propiedadesLocal/local");Whenever you need it. For example within an ActionHandler which loads the bean
    and makes a DTO Object (Bean used by the JSF Page) available for the JSF Page.
    But where you actually have to load the Bean depends on your design.
    andi

  • Help with TableView with POJOs and PropertyValueFactory

    Hi,
    I want to display a POJO without JavaFX Properties in a TableView.
    However, I can't update the cell using a PropertyValueCellFactory.
    It works fine, if I have JavaFX Property. I also tried and implemented PropertyChangeListener support, as it is written in the docs, but it still doesn't work.
    If I implement my own CellValueFactory and add a listener it works.
    Can you help? I guess I forgot something.
    import javafx.application.Application;
    import javafx.beans.property.LongProperty;
    import javafx.beans.property.ObjectProperty;
    import javafx.beans.property.SimpleLongProperty;
    import javafx.beans.property.SimpleObjectProperty;
    import javafx.beans.value.ObservableValue;
    import javafx.collections.FXCollections;
    import javafx.scene.Scene;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableView;
    import javafx.scene.control.cell.PropertyValueFactory;
    import javafx.scene.layout.VBox;
    import javafx.scene.layout.VBoxBuilder;
    import javafx.stage.Stage;
    import javafx.util.Callback;
    import java.beans.PropertyChangeEvent;
    import java.beans.PropertyChangeListener;
    import java.beans.PropertyChangeSupport;
    public class TestApp4 extends Application {
        public static void main(String[] args) {
            launch(args);
        @Override
        public void start(final Stage stage) throws Exception {
            VBox root = new VBox();
            TableView<MyObject> tableView = new TableView<MyObject>();
            TableColumn<MyObject, Number> javafxPropertyColumn = new TableColumn<MyObject, Number>();
            javafxPropertyColumn.setText("JavaFX Property");
            javafxPropertyColumn.setCellValueFactory(new PropertyValueFactory<MyObject, Number>("test1"));
            TableColumn<MyObject, Number> javaBeanColumn = new TableColumn<MyObject, Number>();
            javaBeanColumn.setText("JavaBean");
            javaBeanColumn.setCellValueFactory(new PropertyValueFactory<MyObject, Number>("test2"));
            TableColumn<MyObject, Number> javaBeanColumn2 = new TableColumn<MyObject, Number>();
            javaBeanColumn2.setText("JavaBean2");
            javaBeanColumn2.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<MyObject, Number>, ObservableValue<Number>>() {
                private final ObjectProperty<Number> objectProperty = new SimpleObjectProperty<Number>();
                @Override
                public ObservableValue<Number> call(TableColumn.CellDataFeatures<MyObject, Number> myObjectNumberCellDataFeatures) {
                    myObjectNumberCellDataFeatures.getValue().propertyChangeSupport.addPropertyChangeListener(new PropertyChangeListener() {
                        @Override
                        public void propertyChange(PropertyChangeEvent evt) {
                            System.out.println("PropertyChange: " + evt.getPropertyName());
                            objectProperty.set((Number) evt.getNewValue());
                    return objectProperty;
            tableView.getColumns().add(javafxPropertyColumn);
            tableView.getColumns().add(javaBeanColumn);
            tableView.getColumns().add(javaBeanColumn2);
            final MyObject myObject = new MyObject();
            tableView.setItems(FXCollections.<MyObject>observableArrayList(myObject));
            root.getChildren().add(tableView);
            new Thread(new Runnable() {
                @Override
                public void run() {
                    for (int i = 0; i < 100; i++) {
                        try {
                            Thread.sleep(100);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        myObject.test1Property().set(i);
                        myObject.setTest2(i);
            }).start();
            Scene scene = new Scene(VBoxBuilder.create().children(root).build());
            stage.setScene(scene);
            stage.show();
        public class MyObject {
            private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
            public MyObject() {
            private LongProperty test1 = new SimpleLongProperty();
            public LongProperty test1Property() {
                return test1;
            private long test2;
            public void setTest2(long test2) {
                if (this.test2 != test2) {
                    propertyChangeSupport.firePropertyChange(new PropertyChangeEvent(this, "test2", this.test2, test2));
                    this.test2 = test2;
            public long getTest2() {
                return test2;
    }

    Hi,
    I want to display a POJO without JavaFX Properties in a TableView.
    However, I can't update the cell using a PropertyValueCellFactory.
    It works fine, if I have JavaFX Property. I also tried and implemented PropertyChangeListener support, as it is written in the docs, but it still doesn't work.
    If I implement my own CellValueFactory and add a listener it works.
    Can you help? I guess I forgot something.
    import javafx.application.Application;
    import javafx.beans.property.LongProperty;
    import javafx.beans.property.ObjectProperty;
    import javafx.beans.property.SimpleLongProperty;
    import javafx.beans.property.SimpleObjectProperty;
    import javafx.beans.value.ObservableValue;
    import javafx.collections.FXCollections;
    import javafx.scene.Scene;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableView;
    import javafx.scene.control.cell.PropertyValueFactory;
    import javafx.scene.layout.VBox;
    import javafx.scene.layout.VBoxBuilder;
    import javafx.stage.Stage;
    import javafx.util.Callback;
    import java.beans.PropertyChangeEvent;
    import java.beans.PropertyChangeListener;
    import java.beans.PropertyChangeSupport;
    public class TestApp4 extends Application {
        public static void main(String[] args) {
            launch(args);
        @Override
        public void start(final Stage stage) throws Exception {
            VBox root = new VBox();
            TableView<MyObject> tableView = new TableView<MyObject>();
            TableColumn<MyObject, Number> javafxPropertyColumn = new TableColumn<MyObject, Number>();
            javafxPropertyColumn.setText("JavaFX Property");
            javafxPropertyColumn.setCellValueFactory(new PropertyValueFactory<MyObject, Number>("test1"));
            TableColumn<MyObject, Number> javaBeanColumn = new TableColumn<MyObject, Number>();
            javaBeanColumn.setText("JavaBean");
            javaBeanColumn.setCellValueFactory(new PropertyValueFactory<MyObject, Number>("test2"));
            TableColumn<MyObject, Number> javaBeanColumn2 = new TableColumn<MyObject, Number>();
            javaBeanColumn2.setText("JavaBean2");
            javaBeanColumn2.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<MyObject, Number>, ObservableValue<Number>>() {
                private final ObjectProperty<Number> objectProperty = new SimpleObjectProperty<Number>();
                @Override
                public ObservableValue<Number> call(TableColumn.CellDataFeatures<MyObject, Number> myObjectNumberCellDataFeatures) {
                    myObjectNumberCellDataFeatures.getValue().propertyChangeSupport.addPropertyChangeListener(new PropertyChangeListener() {
                        @Override
                        public void propertyChange(PropertyChangeEvent evt) {
                            System.out.println("PropertyChange: " + evt.getPropertyName());
                            objectProperty.set((Number) evt.getNewValue());
                    return objectProperty;
            tableView.getColumns().add(javafxPropertyColumn);
            tableView.getColumns().add(javaBeanColumn);
            tableView.getColumns().add(javaBeanColumn2);
            final MyObject myObject = new MyObject();
            tableView.setItems(FXCollections.<MyObject>observableArrayList(myObject));
            root.getChildren().add(tableView);
            new Thread(new Runnable() {
                @Override
                public void run() {
                    for (int i = 0; i < 100; i++) {
                        try {
                            Thread.sleep(100);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        myObject.test1Property().set(i);
                        myObject.setTest2(i);
            }).start();
            Scene scene = new Scene(VBoxBuilder.create().children(root).build());
            stage.setScene(scene);
            stage.show();
        public class MyObject {
            private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
            public MyObject() {
            private LongProperty test1 = new SimpleLongProperty();
            public LongProperty test1Property() {
                return test1;
            private long test2;
            public void setTest2(long test2) {
                if (this.test2 != test2) {
                    propertyChangeSupport.firePropertyChange(new PropertyChangeEvent(this, "test2", this.test2, test2));
                    this.test2 = test2;
            public long getTest2() {
                return test2;
    }

  • POJO and persistence

    Hi *,
    Maybe I'm trying something silly but anyway...
    For various reasons I have (read 'would like to have') the following components in my ejb tier.
    A message-driven bean which on reception of a message calls a singleton POJO which processes the data in the message and needs some persistent object in order to do so.
    I thought that because my POJO is created by an application managed MDB, it will also be container managed, but it seems not since e.g. @PersistenceContext is not supported. Am I right?
    No problem I thought, I'll use JNDI to lookup my persistence unit in the following way:
    In the POJO:
    InitialContext ic = new InitialContext();
    EntityManager em = (EntityManager)ic.lookup("java:comp/env/persistence/Z-persistence-ejbPU");and in sun-ejb-jar.xml:
    <sun-ejb-jar>
    <enterprise-beans>
    <persistence-unit-ref>
    <persistence-unit-ref-name>persistence/Z-persistence-ejbPU</persistence-unit-ref-name>
    <persistence-unit-name>Z-persistence-ejbPU</persistence-unit-name>
    </persistence-unit-ref>
    </enterprise-beans>
    </sun-ejb-jar>But this gives me following error:
    file:/C:/Sun/AppServer/domains/domain1/applications/j2ee-apps/Z-persistence/Z-persistence-ejb_jar/-Z-persistence-ejbPU login successful
    javax.naming.NameNotFoundException: No object bound to name java:comp/env/persistence/Z-persistence-ejbPUSo it seems that the PU is not bound to the JNDI context. However, my application uses other entitties which are created and persisted in a session bean and this works.
    Can somebody provide me with a hint of what I'm missing?
    Best regards,
    Vaak

    Hello,
    I am trying the same thing on JBoss 4.2.2,but I am also getting same errori.e the persistent context is not bound to the JNDI name.
    The ejb-jar file:
    <message-driven>
         <ejb-name>MessageReceiver</ejb-name>
         <ejb-class>com.ecebs.hops.messaging.MessageReceiver</ejb-class>
         <activation-config>
              <activation-config-property>
              <activation-config-property-name>destination</activation-config-property-name>
              <activation-config-property-value>queue/hopsLM2/messaging/msgQueue</activation-config-property-value>
              </activation-config-property>
              <activation-config-property>
              <activation-config-property-name>destinationType</activation-config-property-name>
              <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
              </activation-config-property>
         </activation-config>
         <persistence-context-ref>
              <persistence-context-ref-name>hopsLM/messaging/entity_manager</persistence-context-ref-name>
              <persistence-unit-name>hopsMessagingLM</persistence-unit-name>
         </persistence-context-ref>
    </message-driven>
    The error thrown:
    09:38:13,700 ERROR [STDERR] javax.naming.NameNotFoundException: hopsLM not bound
    09:38:13,700 ERROR [STDERR]      at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
    09:38:13,700 ERROR [STDERR]      at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
    09:38:13,700 ERROR [STDERR]      at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
    09:38:13,700 ERROR [STDERR]      at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
    09:38:13,700 ERROR [STDERR]      at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
    If you have resolved it,please suggest what mistakes I have done.
    Thanks and Regards,
    Yugant Shah.

  • POJOs and posting to a Message Broker Channel

    Hi!
    What we need is to let a JCA Connector publish a message to a Message Broker (MB) Channel. (The messages are subsequentliy picked up by a JPD process.)
    One solution is to let te JCA connector send an JMS message, which is translated to a MB message by a JMSEventGenerator. But we don't want the overhead of JMS.
    Is it possible for a JCA connector to publish a message directly on a MB Channel? Is there some kind of API avaiable for this?
    Thanks in advance :-)
    Anders

    I am having a simialr problem here. I have more then one jpd's(workflows). Now if due to some business logic, one of them is publishing an xml into a Message Broker Queue. This message needs to be subscribed globally(at start node) by other workflows. As per my understanding, this can be done by 'Add Message path'.But i am not able to subscribe to the queue. I have added a control for Subscribing it but the 'add message path' requires a start event and i cannot subscribe using onMessage(data) method of subscribe control as we first need to call the subscribe() method of the control.
    So is there a way by which I can globally publish to a queue and fetch the data(xml) from a queue and do further processing in all the workflows.

  • POJOs and Transactions

    I have a class which does writes to the database and also updates a cache. If db is rolled back, i need to rollback the cache... is it possible to associate these java objects to the transaction so that they are automatically rolled back. for isntance, my cache consists of a few hashmaps that map from guids to objects. on db update, these cache values have to changed badck to original.
    any clues ?

    yeah, we have our own cache implementation. and maybe
    i have oversimplified the prblem... the cache is
    actually a bit more than those hashmaps. values in
    those maps have computed associations with other
    objects in the same map. [these computations are
    doneon the fly]Unless your cache was demonstrably better than those you can get elsewhere, I'd suggest that you relieve yourself of that maintainence burden and try something else.
    You wouldn't write your own app server, would you?
    You maintain the associations in the map, and not in the objects themselves? Oh, my.
    i dont really wory about GC, since the cache is not
    anticipated to be too large.Key word there: "anticipated". It'll only be a problem when you're wrong.
    the issue is about making te cache updates the part
    of the same transaction as the database, and
    operations on a few JMS topics - seamless and simple
    way to ensure that the cache is always in sync with
    the transaction in which the resources like the db
    and the jms.Sorry, I still don't see the point. Maybe I'm thick.
    a crude and simple way wd be to take a copy of the
    maps, and perform operations based on
    creates/updates/deletes. But is there an elegant way?I still don't see any reason to make it so.
    I took a look at EHCache, but not sure how that would
    solve my problem ?I'm still not sure you have a problem. What EHCache does do is relieve you of having to maintain code for a cache. It's probably got a larger user base than yours does, which means it's more likely that bugs will be found.
    %

  • Difference Between java bean   And POJO

    Hi,
    What is the difference between the POJO the plain old javaobject and java bean ,
    in my sense what is the basic difference between POJO and the object of a java bean class
    Thanks
    Arun

    http://en.wikipedia.org/wiki/POJO
    http://java.sun.com/products/javabeans/

  • Looking for a better way to observe POJO changes

    Let's say you have a POJO like Employee, and you want to make changes to the fields in the POJO observable. What's the best way to do this? The listeners should be able to register for change events, without necessarily subscribing to every property.
    I could create an ObservableEmployeeHelper that takes an employee and wraps each of the fields in Simple*Property objects, and then fires notifications whenever any of those properties change. But it would be nice for the listeners to be able to pick and choose what they want to listen to -- something like this:
    addListener(EmployeeEvent.ALL, new ChangeListener<ObservableEmployeeHelper>(){...});or
    addListener(EmployeeEvent.SALARY_CHANGE, new ChangeListener<ObservableEmployeeHelper>(){...});The other problem is that the ListCell and TableCell's really don't know how to deal with a change to the POJO instead of to the a single observable attribute. For example, if Employee has a status field (ON_HOLIDAY, ON_SICK_LEAVE, ON_SITE, WORKING_FROM HOME) and you want to display an icon next to the user's name indicating this status. It's difficult to do in way that automatically updates the icon in a list whenever you change the status. My hack for this to attach a listener to the Employee observable status property and watch for changes. But this can lead quickly to memory leaks if not done well.
    And currently if you put the Observable POJOs into an ObservableList, you won't get notified if a particular POJO changes, only if the entire list changes.
    Is there an easier way to watch for changes to any field in a POJO?
    It would be nice if there was an @Observable annotation that you could just add to the fields of your POJO and some kind of mixin that you could add to the class that would propagate changes, register listeners, etc.
    Edited by: mfortner on Aug 6, 2012 5:00 PM

    I think you'll need to build somekind of custom solution for this.
    I've done this for my own program so I can monitor changes in any of the properties using just one listener. This helps me to do two things:
    1) Monitor when an object has changed (if any of its properties was changed), and register the object for future storage (unless modified again within a specific timeout)
    2) Monitor when an object was accessed (if a specific set of properties was read), and schedule the object for enrichment (fetching additional data in the background)
    Using properties for this is great because a lot of action can simply be done in the background and as soon as the information is available the UI will update. For example, when the Photo property is accessed the first time by binding it to an ImageView, the Photo won't have loaded yet (it's null). The access is noticed though, and so a background thread loads the Photo from the database. When this process is finished, it updates the Photo property -- thanks to the binding to ImageView, the Photo will be updated automatically in the UI.
    The advantage of course is that I donot need to fetch these things myself anymore -- the program will do this automatically... and for only those objects that actually were accessed (the rest will remain in a minimal state until actually used).
    Same for the automated storage. I just bind a property to the UI, or multiple of them, and when any of them is changed, a process starts that waits for 3 seconds before storing the object. If any more changes occured in the mean time, the timer resets.

  • Weblogic 10.3 POJO to EJB 3.0 call using JNDI

    Hi all,
    We are upgrading our applications from OAS to WL 10.3 and I am running into EJB lookup issues. Here is what I currently have in terms of setup.
    One EAR file being deployed and there are two main jar files in it that communicate with each other. The first jar file contains POJOs and the second is an EJB jar file. One of the classes in the POJO jar file is doing a lookup for an EJB that can be found in the EJB jar file.
    EAR file
    ---> POJO jar
    ---> EJB jar file
    The EJB itself is declared as follows
    @Stateless
    public class MyBean implements MyBeanService
    I added ejb-jar.xml and weblogic-ejb-jar.xml DDs to my ejb jar file and the bean reference shows up in the Weblogic console under the application after the deployment.
    ejb-jar.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0">
    <enterprise-beans>
              <session>
                   <ejb-name>MyBean</ejb-name>
                   <business-local>package.MyBeanService</business-local>
                   <ejb-class>package.MyBean</ejb-class>
                   <session-type>Stateless</session-type>
              </session>
         </enterprise-beans>
    </ejb-jar>
    weblogic-ejb-jar.xml
    <weblogic-ejb-jar xmlns="http://www.bea.com/ns/weblogic/90"
    xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.bea.com/ns/weblogic/90
    http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd">
         <weblogic-enterprise-bean>
              <ejb-name>MyBean</ejb-name>
              <jndi-name>ejb/MyBeanService</jndi-name>
         </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    My POJO call to JNDI is
    InitialContext initialContext = new InitialContext();
    Object found = initialContext.lookup("ejb/MyBeanService"); //---------------------FAILS ON THE LOOKUP ON THIS LINE
    System.out.println(found.getClass());
    Error
    javax.naming.NameNotFoundException: Unable to resolve 'ejb.MyBeanService'. Resolved 'ejb'; remaining name 'MyBeanService'
    Am I not using the right lookup name? Must I prefix the call with the name of my ejb jar name?
    Thanks
    S.

    Hi,
    I made the changes as requested and it looks as follows.
    <weblogic-ejb-jar xmlns="http://www.bea.com/ns/weblogic/90"
    xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.bea.com/ns/weblogic/90
    http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd">
         <weblogic-enterprise-bean>
              <ejb-name>MyBean</ejb-name>
              <stateless-session-descriptor>
                        <business-local>package.MyBeanService</business-local>
                        <jndi-name>ejb/MyBeanService</jndi-name>
                   </business-interface-jndi-name-map>
              </stateless-session-descriptor>
         </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    I don't think <business-remote> works in <business-interface-jndi-name-map>.
    VALIDATION PROBLEMS WERE FOUND problem: cvc-complex-type.2.4a: Expected element 'business-remote@http://xmlns.oracle.com/weblogic/weblogic-ejb-jar' instead of 'business-local@http://xmlns.oracle.com/weblogic/weblogic-ejb-jar' here in element business-interface-jndi-name-map@http://xmlns.oracle.com/weblogic/weblogic-ejb-jar:<null> problem: cvc-complex-type.2.4a: Expected element 'business-remote@http://xmlns.oracle.com/weblogic/weblogic-ejb-jar' instead of 'jndi-name@http://xmlns.oracle.com/weblogic/weblogic-ejb-jar' here in element business-interface-jndi-name-map@http://xmlns.oracle.com/weblogic/weblogic-ejb-jar:<null> problem: cvc-complex-type.2.4c: Expected element 'business-remote@http://xmlns.oracle.com/weblogic/weblogic-ejb-jar' before the end of the content in element business-interface-jndi-name-map@http://xmlns.oracle.com/weblogic/weblogic-ejb-jar:<null>
    Anyhow if I use the <business-remote> I still get the following error when I call
    Object found = initialContext.lookup("ejb/MyBeanService"); ----> ERROR
    javax.naming.NameNotFoundException: Unable to resolve 'ejb.MyBeanService'. Resolved 'ejb'; remaining name 'MyBeanService'
    Thanking you in advance.
    S.

  • Value not displayed correctly when sent through a Java POJO datasource, but is perfect when used with MySQL.

    I have this strange problem - A field value is displayed correctly in the crystal report when pulled from MySQL table (field is Varchar(25)). But the same field when loaded into a Java POJO and set the POJO as new datasource the value is garbled up.
    Any ideas?
    Thanks,

    Early implementations of the POJO Factory set the default display size to 12, which caused corruption in the display starting from the 12th character when the size exceeded the display size.
    Would you try specifying the MemberColumnDisplaySize property for that column in POJOResultSetFactory to reflect the actual size?
    Sincerely,
    Ted Ueda - Developer Support

  • POJOs or EJBs for worker classes spawned from Application Module?

    Hello,
    I'm running JDev 11.1.2.3.0.
    I need to create a couple of worker classes that will be instantiated from my Application Module. The first will invoke PL/SQL via createCallableStatement. The second sends a message to a jabber server.
    In the Java EE world, I'd do this with stateless EJBs and use the @PreConstruct and @PostDestroy annotations to control the lifecycle.
    What is the recommended approach with ADF when using Classes to make these calls from an Application Module? Should one use POJOs and rely on WebLogic to handle garbage collection, or should/can one use EJB 3.0 stateless session beans?
    Many thanks.
    Edited by: user576183 on May 11, 2013 9:24 AM

    Stateless session beans is the recommended approach with ADF BC too.
    http://docs.oracle.com/cd/E14571_01/web.1111/b31974/bcextservices.htm
    http://technology.amis.nl/2013/01/20/adf-interaction-with-business-service-an-ongoing-discussion/

  • Remote pojo question.

    I have delegates which are calling remote session beans that return ValueObjects. The remote client then may modify these value objects and return them later to the application via the an appropriate session bean. I would then like to save any changes that have been made.
    I expect the Value objects to be POJOs, and not have ties to Toplink. However, when return these VOs, i get a class not found exception:
    Caused by: java.lang.ClassNotFoundException: oracle.toplink.indirection.IndirectList (no security manager: RMI class loader disabled)
    I don't understand why the client has to know that I am using toplink to handle persistence for these POJOs.
    Am I using an incorrect session or something?
    Here is my code to get the session:
    Project proj = new TLCeleres();
    sServer = proj.createServerSession();
    sServer.login("pago_temp", "pago_temp");
    Session session = sServer.acquireClientSession();
    Here is my code to populate the vector of VOs which are returned by the session bean:
    ReadAllQuery query= new ReadAllQuery();
                   query.setReferenceClass(QueryBarFacilityValue.class);
                   query.setSelectionCriteria(new ExpressionBuilder().get("id").equal(queryBarId));
                   query.addJoinedAttribute("Facility");
                   Vector results= (Vector)getSession().executeQuery(query);
                   facilities= new Vector(results.size());
                   Iterator iter= results.iterator();
                   while (iter.hasNext())
                        facilities.add(((QueryBarFacilityValue)iter.next()).getFacility());
    Thanks in advance,
    craig

    Craig,
    The client does not need to know anything about TopLink. The issue is that you have transparent indirection enabled on your collection relationship mapping(s).
    Indirection is an excellent performance enhancement on the server side but it is stateful and does not serialize to the client easily.
    Check you mappings and ensure that indirection is disabled for the relationship(s) in question.
    Doug

  • Save point with POJO DataControl not saving model state

    Hi Guys,
    JDEV 11.1.1.6 64bit
    I was able to get save points working with ADF BC (AppMod, View & Entity objects)
    but when I tried to do the exact same with Pojo DataControls, I won't save
    the current state of the model - meaning things are not "selected" to the
    proper record when the SP is restored. I don't get any errors, it just
    shows the wrong data.
    Example:
    The BTF is marked as must have transaction(tried either way), but this is Pojo, and doesn't support Trx.
    edit-emp-dept.jspx (with BTF Region)
    BTF START
        STEP 1: RichTable with bindings to Pojo DataControl (value="#{bindings.allDepts.collectionModel}")
                     (user selects the 3 record => sales department)
        STEP 2: Edit Sales Dept & on click to next step create SP
        STEP 3: View Emps (Rich Table of ALL emps in that DEPT)
        STEP 4: Edit Emp
        FINAL: COMMIT (save to pojo list) or CANCEL (don't save to pojo list)
    /BTF END
    At STEP 1 -> STEP 2, the SP is created, and when I close the browser at STEP2, 3  or 4, and
    restart, and choose SP to restore, it takes me to proper page (STEP 2)  but the wrong Department is
    selected to edit (it shows "Finance" instead of "Sales") & if I hit my ADF back button, it shows
    the table with "finance" selected.  In the ADF BC world it works perfectly.
    I know the docs say: the ADF Model is saved, so the question is why bindings.allDepts.collectionModel
    not "saved" here for Pojo DC and the ADF BC af:table value="#{bindings.DepartmentsView1.collectionModel}"
    it is "saved".
    Thanks for any insight or work-around.
    Sincerely,
    Joel
    edit-emp-dept.jspx:
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
      <jsp:directive.page contentType="text/html;charset=UTF-8"/>
      <f:view>
        <af:document id="d1">
          <af:form id="f1">
            <af:region value="#{bindings.btfpojodc1.regionModel}" id="r1"/>
          </af:form>
        </af:document>
      </f:view>
    </jsp:root>

    Hi,
    the problem with POJO DC and other non-ADF BC models is that they don't passivate their state. In JDeveloper 12c we allow developers to extend their POJO classes with ADF lifecycle methods that allows them to save the model state themselves. Its a known issue that the transaction state cannot be saved for non-ADF BC models. I checked the bug database for bugs filed against this behavior but could not find one- I can imagine that with 12c we would have a chance to allow developers to handle passivation / activation for non-ADF BC model states. So if this is a feature you need then filing an enhancement request would make sense
    Frank

  • Upload excel file and display content in sapui5 table

    hi:all
       how to upload  excel files and display its contents in the view of sapui5  table ,then  'create ' these data into the abap database using odataservice.
         Do you have any solutions ? I appreciate for your help.

    Two possible way come to mind.
    1. ADF DI (desktop integration): sorry, don't know enough about it to give a how to :-(
    2. POI (http://poi.apache.org/) : open source project to read and write excel file with java. Using POI you can open the .xsl file, read it's contents and display it as af:table. For this you need to read the xsl into a data structure (this can be a temporary db table or a list of POJOs) and build a data control out of it. This you can drop on a page as table.
    Timo
    Edited by: Timo Hahn on 15.02.2010 13:59

Maybe you are looking for

  • SQL user defined type mapping with Java Class type

    SECRET_TAB_TYPE is userdefined type in SQL Schema. but accessing this way it is giving invalid column type error(see code below )?? I have made a class with same name attributes as in SQL Type Connection con = DriverManager.getConnection(URL,Username

  • Split message in files

    This is my sender message Payload : <?xml version="1.0" encoding="UTF-8"?> <ns0:INOVIS_Sender xmlns:ns0="urn://Inovis.com"> <B>1</B> <B>2</B> <B>3</B> </ns0:INOVIS_Sender> This is my receiver message payload : <?xml version="1.0" encoding="UTF-8"?> <

  • Exception:Exceeded the configured max no.of Connection!!!!

    Folks I need some urgent help please, I have developed an application that sends messages in XML Format to the Server and the server sends a response back. A new request is sent by the client as soon as it receives a response from the client So if I

  • SAP user assigned with roles from HR-ORG incorrectly

    Hi All I have an issue where a SAP user appears to be receiving role assignments from some HR-ORG object erroneously. I have checked the user's HR positions and organisational assignments and they do not have any roles assigned. I also checked the jo

  • Organiser Frozen

    Win: Elements 6 opens on the "Organizer" page and immediately freezes whole system. Help please?