• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Can't map to target entity property

 
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

With Jboss71, Hibernate 3, when I deploy a ejb module, jboss can't map my user-defined class to a target entity property.

Here is the error:

09:10:06,739 INFO [org.jboss.ws.common.management.DefaultEndpointRegistry] (MSC service thread 1-8) register: jboss.ws:context=category6-ws-web,endpoint=CategorySubcategoriesServiceImpl
09:10:06,740 INFO [org.jboss.ws.common.management.DefaultEndpointRegistry] (MSC service thread 1-8) register: jboss.ws:context=category6-ws-web,endpoint=CategoryImagesServiceImpl
09:10:06,759 INFO [org.jboss.jpa] (MSC service thread 1-1) JBAS011402: Starting Persistence Unit Service 'category6-ws-ear.ear/category6-ws-ejb.jar#HousewareCategoryPU'
09:10:06,839 INFO [org.hibernate.annotations.common.Version] (MSC service thread 1-1) HCANN000001: Hibernate Commons Annotations {4.0.0.CR2}
09:10:06,842 INFO [org.hibernate.Version] (MSC service thread 1-1) HHH00412:Hibernate Core {4.0.0.CR2}
09:10:06,843 INFO [org.hibernate.cfg.Environment] (MSC service thread 1-1) HHH00206:hibernate.properties not found
09:10:06,846 INFO [org.hibernate.cfg.Environment] (MSC service thread 1-1) HHH00021:Bytecode provider name : javassist
09:10:06,858 INFO [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-1) HHH00204:Processing PersistenceUnitInfo [
name: HousewareCategoryPU
...]
09:10:06,897 INFO [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-8) Creating Service {http://service.category.houseware.ix/}CategorySubcategoriesServiceImplService from class ix.houseware.category.service.CategorySubcategoriesService
09:10:06,977 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.persistenceunit."category6-ws-ear.ear/category6-ws-ejb.jar#HousewareCategoryPU": org.jboss.msc.service.StartException in service jboss.persistenceunit."category6-ws-ear.ear/category6-ws-ejb.jar#HousewareCategoryPU": Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1780) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) [:1.6.0_07]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) [:1.6.0_07]
at java.lang.Thread.run(Thread.java:619) [:1.6.0_07]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: HousewareCategoryPU] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:908)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:884)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:145)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:78)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
... 3 more
Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: ix.houseware.category.entity.CategoryImages.categorySubcategories in ix.houseware.category.entity.CategorySubcategories.categoryImagesCollection
at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:665)
at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:625)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:65)
at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1573)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1346)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1711)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:76)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:899)
... 9 more



´╗┐CategoryImages.java class:


CategorySubcategories.java class:


Any suggestion is very appreciated.
Thanks
Sam
 
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Change:
@OneToMany(cascade = CascadeType.ALL, mappedBy = "categorySubcategories")
private Collection<CategoryImages> categoryImagesCollection;

To:
@OneToMany(cascade = CascadeType.ALL, mappedBy = "categoryId")
private Collection<CategoryImages> categoryImagesCollection;

 
sam White
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hebert Coelho wrote:Change:
@OneToMany(cascade = CascadeType.ALL, mappedBy = "categorySubcategories")
private Collection<CategoryImages> categoryImagesCollection;

To:
@OneToMany(cascade = CascadeType.ALL, mappedBy = "categoryId")
private Collection<CategoryImages> categoryImagesCollection;



Hi, thank you for the suggestion.
After changed it to categoryId, it thrown a different exception, error shown as below:

20:06:07,048 INFO [stdout] (http-portal.ixsystems.com.au-192.168.1.20-8080-2)
20:06:07,048 INFO [stdout] (http-portal.ixsystems.com.au-192.168.1.20-8080-2)
20:06:07,048 INFO [stdout] (http-portal.ixsystems.com.au-192.168.1.20-8080-2) CategoryImagesServiceImpl Hello count()...
20:06:07,065 INFO [stdout] (http-portal.ixsystems.com.au-192.168.1.20-8080-2) ****calling AbstractFacade().....**********
20:06:07,144 INFO [stdout] (http-portal.ixsystems.com.au-192.168.1.20-8080-2) Hibernate:
20:06:07,144 INFO [stdout] (http-portal.ixsystems.com.au-192.168.1.20-8080-2) select
20:06:07,144 INFO [stdout] (http-portal.ixsystems.com.au-192.168.1.20-8080-2) count((categoryim0_.image_id,
20:06:07,145 INFO [stdout] (http-portal.ixsystems.com.au-192.168.1.20-8080-2) categoryim0_.category_id)) as col_0_0_
20:06:07,145 INFO [stdout] (http-portal.ixsystems.com.au-192.168.1.20-8080-2) from
20:06:07,145 INFO [stdout] (http-portal.ixsystems.com.au-192.168.1.20-8080-2) houseware.category_images categoryim0_ limit ?
20:06:07,163 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-portal.ixsystems.com.au-192.168.1.20-8080-2) SQL Error: 1241, SQLState: 21000
20:06:07,163 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-portal.ixsystems.com.au-192.168.1.20-8080-2) Operand should contain 1 column(s)
20:06:07,166 INFO [org.hibernate.engine.jdbc.internal.LogicalConnectionImpl] (http-portal.ixsystems.com.au-192.168.1.20-8080-2) HHH00106:Forcing container resource cleanup on transaction completion
20:06:07,167 ERROR [org.jboss.ws.common.invocation.InvocationHandlerJAXWS] (http-portal.ixsystems.com.au-192.168.1.20-8080-2) Method invocation failed with exception: null: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_07]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_07]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_07]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_07]
at org.jboss.ws.common.invocation.AbstractInvocationHandlerJSE.invoke(AbstractInvocationHandlerJSE.java:111)
at org.jboss.wsf.stack.cxf.JBossWSInvoker._invokeInternal(JBossWSInvoker.java:169)
at org.jboss.wsf.stack.cxf.JBossWSInvoker.invoke(JBossWSInvoker.java:117)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [:1.6.0_07]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [:1.6.0_07]
at java.util.concurrent.FutureTask.run(FutureTask.java:138) [:1.6.0_07]
at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:118)
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:208)
at org.jboss.wsf.stack.cxf.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:91)
at org.jboss.wsf.stack.cxf.transport.ServletHelper.callRequestHandler(ServletHelper.java:167)
at org.jboss.wsf.stack.cxf.CXFServletExt.invoke(CXFServletExt.java:87)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.jboss.wsf.stack.cxf.CXFServletExt.service(CXFServletExt.java:135)
at org.jboss.wsf.spi.deployment.WSFServlet.service(WSFServlet.java:140) [jbossws-spi-2.0.0.Beta10.jar:2.0.0.Beta10]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49) [jboss-as-jpa-7.1.0.Alpha2-SNAPSHOT.jar:7.1.0.Alpha2-SNAPSHOT]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:144) [jboss-as-web-7.1.0.Alpha2-SNAPSHOT.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:670) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at java.lang.Thread.run(Thread.java:619) [:1.6.0_07]
Caused by: java.lang.RuntimeException: javax.persistence.PersistenceException: org.hibernate.exception.DataException: Operand should contain 1 column(s)
at ix.houseware.category.service.CategoryImagesServiceImpl.count(CategoryImagesServiceImpl.java:31) [classes:]
... 39 more
20:06:07,172 WARNING [org.apache.cxf.phase.PhaseInterceptorChain] (http-portal.ixsystems.com.au-192.168.1.20-8080-2) Application {http://service.category.houseware.ix/}CategoryImagesServiceImplService#{http://service.category.houseware.ix/}count has thrown exception, unwinding now: org.apache.cxf.interceptor.Fault: javax.persistence.PersistenceException: org.hibernate.exception.DataException: Operand should contain 1 column(s)
at org.jboss.wsf.stack.cxf.JBossWSInvoker.createFault(JBossWSInvoker.java:234)
at org.jboss.wsf.stack.cxf.JBossWSInvoker._invokeInternal(JBossWSInvoker.java:189)
at org.jboss.wsf.stack.cxf.JBossWSInvoker.invoke(JBossWSInvoker.java:117)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [:1.6.0_07]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [:1.6.0_07]
at java.util.concurrent.FutureTask.run(FutureTask.java:138) [:1.6.0_07]
at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:118)
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:208)
at org.jboss.wsf.stack.cxf.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:91)
at org.jboss.wsf.stack.cxf.transport.ServletHelper.callRequestHandler(ServletHelper.java:167)
at org.jboss.wsf.stack.cxf.CXFServletExt.invoke(CXFServletExt.java:87)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.jboss.wsf.stack.cxf.CXFServletExt.service(CXFServletExt.java:135)
at org.jboss.wsf.spi.deployment.WSFServlet.service(WSFServlet.java:140) [jbossws-spi-2.0.0.Beta10.jar:2.0.0.Beta10]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49) [jboss-as-jpa-7.1.0.Alpha2-SNAPSHOT.jar:7.1.0.Alpha2-SNAPSHOT]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:144) [jboss-as-web-7.1.0.Alpha2-SNAPSHOT.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:670) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952) [jbossweb-7.0.2.Final.jar:7.1.0.Alpha2-SNAPSHOT]
at java.lang.Thread.run(Thread.java:619) [:1.6.0_07]
Caused by: java.lang.RuntimeException: javax.persistence.PersistenceException: org.hibernate.exception.DataException: Operand should contain 1 column(s)
at ix.houseware.category.service.CategoryImagesServiceImpl.count(CategoryImagesServiceImpl.java:31) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_07]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_07]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_07]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_07]
at org.jboss.ws.common.invocation.AbstractInvocationHandlerJSE.invoke(AbstractInvocationHandlerJSE.java:111)
at org.jboss.wsf.stack.cxf.JBossWSInvoker._invokeInternal(JBossWSInvoker.java:169)
... 33 more



Thanks
Sam
 
Space pants. Tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic