I'm trying to map a simple many-to-one. Similar mappings I've done many times before but this one is driving me mad.....
net.sf.hibernate.MappingException: Foreign key (clips [link_id])) must have same number of columns as the referenced primary key (links [link_cona_id,link_elr_name])
as the exception states.
The only place where the two offending columns are used together is in another mapping where
xml mapping below.
It's probably a stupid typo by me but I can't see it. If anyone can help I would be most grateful.
[DEBUG,Configuration] null<-org.dom4j.tree.DefaultAttribute@979e8b [Attribute: name resource value "omnieng/burnbaby/beans/Clip.xml"]
[INFO,Configuration] Mapping resource: omnieng/burnbaby/beans/Clip.xml
[DEBUG,DTDEntityResolver] trying to locate
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
[DEBUG,DTDEntityResolver] found
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
[INFO,Binder] Mapping class: omnieng.burnbaby.beans.Clip -> clips
[DEBUG,CacheFactory] cache for: omnieng.burnbaby.beans.Clip usage strategy: read-write
[DEBUG,Binder] Mapped property: id -> id, type: long
[DEBUG,Binder] Mapped property: start -> startMiles, type: float
[DEBUG,Binder] Mapped property: end -> endMiles, type: float
[DEBUG,Binder] Mapped property: order -> order_id, type: omnieng.burnbaby.beans.Order
[DEBUG,Binder] Mapped property: link -> link_id, type: omnieng.burnbaby.beans.Link
[DEBUG,Binder] Named query: allClips ->
from Clip order by orderId, id
[DEBUG,Binder] Named query: clipsByOrder ->
from Clip where orderId = :orderId order by id
[DEBUG,Configuration] null<-org.dom4j.tree.DefaultAttribute@55bb93 [Attribute: name resource value "omnieng/burnbaby/beans/Order.xml"]
[INFO,Configuration] Mapping resource: omnieng/burnbaby/beans/Order.xml
[DEBUG,DTDEntityResolver] trying to locate
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
[DEBUG,DTDEntityResolver] found
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
[INFO,Binder] Mapping class: omnieng.burnbaby.beans.Order -> orders
[DEBUG,Binder] Mapped property: id -> id, type: long
[DEBUG,Binder] Mapped property: created -> created, type: timestamp
[DEBUG,Binder] Mapped property: clips, type: java.util.Set
[DEBUG,Binder] Named query: allOrders ->
from Order order by created desc
[DEBUG,Configuration] null<-org.dom4j.tree.DefaultAttribute@12789d2 [Attribute: name resource value "omnieng/burnbaby/beans/Camera.xml"]
[INFO,Configuration] Mapping resource: omnieng/burnbaby/beans/Camera.xml
[DEBUG,DTDEntityResolver] trying to locate
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
[DEBUG,DTDEntityResolver] found
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
[INFO,Binder] Mapping class: omnieng.burnbaby.beans.Camera -> camera
[DEBUG,CacheFactory] cache for: omnieng.burnbaby.beans.Camera usage strategy: read-only
[DEBUG,Binder] Mapped property: id -> cam_id, type: integer
[DEBUG,Binder] Mapped property: description -> cam_desc, type: string
[DEBUG,Binder] Named query: allCameras ->
from Camera order by description
[DEBUG,Configuration] null<-org.dom4j.tree.DefaultAttribute@13576a2 [Attribute: name resource value "omnieng/burnbaby/beans/ELR.xml"]
[INFO,Configuration] Mapping resource: omnieng/burnbaby/beans/ELR.xml
[DEBUG,DTDEntityResolver] trying to locate
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
[DEBUG,DTDEntityResolver] found
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
[INFO,Binder] Mapping class: omnieng.burnbaby.beans.ELR -> elr
[DEBUG,CacheFactory] cache for: omnieng.burnbaby.beans.ELR usage strategy: read-only
[DEBUG,Binder] Mapped property: name -> elr_name, type: string
[DEBUG,Binder] Mapped property: trids, type: java.util.Set
[DEBUG,Binder] Named query: allELRs ->
from ELR order by name
[DEBUG,Configuration] null<-org.dom4j.tree.DefaultAttribute@17b0998 [Attribute: name resource value "omnieng/burnbaby/beans/TRID.xml"]
[INFO,Configuration] Mapping resource: omnieng/burnbaby/beans/TRID.xml
[DEBUG,DTDEntityResolver] trying to locate
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
[DEBUG,DTDEntityResolver] found
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
[INFO,Binder] Mapping class: omnieng.burnbaby.beans.TRID -> elrtrid
[DEBUG,CacheFactory] cache for: omnieng.burnbaby.beans.TRID usage strategy: read-only
[DEBUG,Binder] Mapped property: id -> elrt_trid, type: string
[DEBUG,Binder] Mapped property: elrName -> elrt_elr_name, type: string
[INFO,ReflectHelper] reflection optimizer disabled for: omnieng.burnbaby.beans.TRIDId, VerifyError: (class: omnieng/burnbaby/beans/TRIDId$$BulkBeanByCGLIB$$7474e8bc, method: setPropertyValues signature: (Ljava/lang/Object;[Ljava/lang/Object;)V) Expecting to find array of objects or arrays on stack
[DEBUG,Binder] Mapped property: key -> elrt_trid, elrt_elr_name, type: omnieng.burnbaby.beans.TRIDId
[DEBUG,Binder] Mapped property: elr -> elrt_elr_name, type: omnieng.burnbaby.beans.ELR
[DEBUG,Binder] Mapped property: links, type: java.util.Set
[DEBUG,Configuration] null<-org.dom4j.tree.DefaultAttribute@1eb0 [Attribute: name resource value "omnieng/burnbaby/beans/Link.xml"]
[INFO,Configuration] Mapping resource: omnieng/burnbaby/beans/Link.xml
[DEBUG,DTDEntityResolver] trying to locate
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
[DEBUG,DTDEntityResolver] found
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
[INFO,Binder] Mapping class: omnieng.burnbaby.beans.Link -> links
[DEBUG,CacheFactory] cache for: omnieng.burnbaby.beans.Link usage strategy: read-only
[DEBUG,Binder] Mapped property: id -> link_id, type: long
[DEBUG,Binder] Mapped property: description -> link_desc, type: string
[DEBUG,Binder] Mapped property: startMiles -> link_start_mileage, type: string
[DEBUG,Binder] Mapped property: endMiles -> link_end_mileage, type: string
[DEBUG,Binder] Mapped property: startGridSequence -> link_start_gridseq, type: double
[DEBUG,Binder] Mapped property: endGridSequence -> link_end_gridseq, type: double
[DEBUG,Binder] Mapped property: trid -> link_elrt_trid, link_elr_name, type: omnieng.burnbaby.beans.TRID
[DEBUG,Configuration] null<-org.dom4j.tree.DefaultAttribute@4ac216 [Attribute: name resource value "omnieng/burnbaby/beans/ContractArea.xml"]
[INFO,Configuration] Mapping resource: omnieng/burnbaby/beans/ContractArea.xml
[DEBUG,DTDEntityResolver] trying to locate
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
[DEBUG,DTDEntityResolver] found
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
[INFO,Binder] Mapping class: omnieng.burnbaby.beans.ContractArea -> contract_area
[DEBUG,CacheFactory] cache for: omnieng.burnbaby.beans.ContractArea usage strategy: read-only
[DEBUG,Binder] Mapped property: id -> cona_id, type: integer
[DEBUG,Binder] Mapped property: name -> cona_name, type: string
[INFO,Binder] Mapping collection: omnieng.burnbaby.beans.ContractArea.elrs -> links
[DEBUG,Binder] Mapped property: elrs, type: java.util.Set
[DEBUG,Binder] Named query: allContractAreas ->
from ContractArea order by cona_name
[INFO,Configuration] Configured SessionFactory: null
[DEBUG,Configuration] properties: {java.vendor=Sun Microsystems Inc., show_sql=false, catalina.base=/usr/local/tomcat, c3p0.min_size=2, sun.management.compiler=HotSpot Client Compiler, catalina.useNaming=true, os.name=Linux, sun.boot.class.path=/usr/java/jdk1.5.0/jre/lib/rt.jar:/usr/java/jdk1.5.0/jre/lib/i18n.jar:/usr/java/jdk1.5.0/jre/lib/sunrsasign.jar:/usr/java/jdk1.5.0/jre/lib/jsse.jar:/usr/java/jdk1.5.0/jre/lib/jce.jar:/usr/java/jdk1.5.0/jre/lib/charsets.jar:/usr/java/jdk1.5.0/jre/classes, sun.desktop=gnome, hibernate.c3p0.max_size=100, java.vm.specification.vendor=Sun Microsystems Inc., c3p0.max_size=100, java.runtime.version=1.5.0-b64, hibernate.c3p0.min_size=2, c3p0.acquire_increment=1, hibernate.cache.provider_class=net.sf.ehcache.hibernate.Provider, user.name=tims, shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar, tomcat.util.buf.StringCache.byte.enabled=true, hibernate.c3p0.timeout=3000, user.language=en, java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory, sun.boot.library.path=/usr/java/jdk1.5.0/jre/lib/i386, java.version=1.5.0, user.timezone=Europe/London, sun.arch.data.model=32, hibernate.use_outer_join=true, java.endorsed.dirs=/usr/local/tomcat/common/endorsed, sun.cpu.isalist=, sun.jnu.encoding=UTF-8, file.encoding.pkg=sun.io, package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.,sun.beans., file.separator=/, java.specification.name=Java Platform API Specification, hibernate.cglib.use_reflection_optimizer=true, java.class.version=49.0, user.country=GB, java.home=/usr/java/jdk1.5.0/jre, java.vm.info=mixed mode, sharing, os.version=2.6.6-1.435.2.3custom, path.separator=:, c3p0.idle_test_period=100, java.vm.version=1.5.0-b64, java.awt.printerjob=sun.print.PSPrinterJob, sun.io.unicode.encoding=UnicodeLittle, package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper., java.naming.factory.url.pkgs=org.apache.naming, user.home=/home/tims, java.specification.vendor=Sun Microsystems Inc., java.library.path=/usr/java/jdk1.5.0/jre/lib/i386/client:/usr/java/jdk1.5.0/jre/lib/i386:/usr/java/jdk1.5.0/jre/../lib/i386:/usr/X11R6/lib:/usr/X11R6/lib/modules, java.vendor.url=http://java.sun.com/, java.vm.vendor=Sun Microsystems Inc., common.loader=${catalina.home}/common/classes,${catalina.home}/common/i18n/*.jar,${catalina.home}/common/endorsed/*.jar,${catalina.home}/common/lib/*.jar, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, java.class.path=/usr/java/jdk1.5.0/lib/tools.jar:/usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/commons-logging-api.jar, use_outer_join=true, c3p0.timeout=3000, java.vm.specification.name=Java Virtual Machine Specification, java.vm.specification.version=1.0, catalina.home=/usr/local/tomcat, sun.cpu.endian=little, sun.os.patch.level=unknown, java.io.tmpdir=/usr/local/tomcat/temp, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, server.loader=${catalina.home}/server/classes,${catalina.home}/server/lib/*.jar, os.arch=i386, java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment, java.ext.dirs=/usr/java/jdk1.5.0/jre/lib/ext, user.dir=/usr/local/jakarta-tomcat-5.5.4/bin, hibernate.c3p0.idle_test_period=100, line.separator=
, java.vm.name=Java HotSpot(TM) Client VM, hibernate.c3p0.acquire_increment=1, file.encoding=UTF-8, java.specification.version=1.5, c3p0.max_statements=0, hibernate.c3p0.max_statements=0, hibernate.show_sql=false}
[INFO,LocalSessionFactoryBean] Building new Hibernate SessionFactory
[INFO,Configuration] processing one-to-many association mappings
[DEBUG,Binder] Second pass for collection: omnieng.burnbaby.beans.Order.clips
[INFO,Binder] Mapping collection: omnieng.burnbaby.beans.Order.clips -> clips
[DEBUG,CacheFactory] cache for: omnieng.burnbaby.beans.Order.clips usage strategy: read-write
[DEBUG,Binder] Mapped collection key: order_id, one-to-many: omnieng.burnbaby.beans.Clip
[DEBUG,Binder] Second pass for collection: omnieng.burnbaby.beans.ELR.trids
[INFO,Binder] Mapping collection: omnieng.burnbaby.beans.ELR.trids -> elrtrid
[DEBUG,CacheFactory] cache for: omnieng.burnbaby.beans.ELR.trids usage strategy: read-only
[DEBUG,Binder] Mapped collection key: elrt_elr_name, one-to-many: omnieng.burnbaby.beans.TRID
[DEBUG,Binder] Second pass for collection: omnieng.burnbaby.beans.TRID.links
[INFO,Binder] Mapping collection: omnieng.burnbaby.beans.TRID.links -> links
[DEBUG,CacheFactory] cache for: omnieng.burnbaby.beans.TRID.links usage strategy: read-only
[DEBUG,Binder] Mapped collection key: link_elrt_trid, link_elr_name, one-to-many: omnieng.burnbaby.beans.Link
[DEBUG,Binder] Second pass for collection: omnieng.burnbaby.beans.ContractArea.elrs
[DEBUG,CacheFactory] cache for: omnieng.burnbaby.beans.ContractArea.elrs usage strategy: read-only
[DEBUG,Binder] Mapped collection key: link_cona_id, element: link_elr_name, type: omnieng.burnbaby.beans.ELR
[INFO,Configuration] processing one-to-one association property references
[INFO,Configuration] processing foreign key constraints
[DEBUG,Configuration] resolving reference to class: omnieng.burnbaby.beans.Link
[ERROR,[/burnbaby]] DVDBurnbaby: ServletException
javax.servlet.ServletException: Could not load class omnieng.burnbaby.pages.BorderEngine from WebappClassLoader
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@10f11b8
: null
at org.apache.tapestry.ApplicationServlet.createEngine(ApplicationServlet.java:675)
at org.apache.tapestry.ApplicationServlet.getEngine(ApplicationServlet.java:379)
at org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:191)
at org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:158)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:526)
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:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:731)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
**********************************************************
javax.servlet.ServletException: Could not load class omnieng.burnbaby.pages.BorderEngine from WebappClassLoader
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@10f11b8
: null
org.apache.tapestry.ApplicationRuntimeException: Could not load class omnieng.burnbaby.pages.BorderEngine from WebappClassLoader
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@10f11b8
: null
java.lang.ExceptionInInitializerError
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'orderManager' defined in resource for InputStream: Can't resolve reference to bean 'nvsSessionFactory' while setting property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nvsSessionFactory' defined in resource for InputStream: Initialization of bean failed; nested exception is net.sf.hibernate.MappingException: Foreign key (clips [link_id])) must have same number of columns as the referenced primary key (links [link_cona_id,link_elr_name])
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nvsSessionFactory' defined in resource for InputStream: Initialization of bean failed; nested exception is net.sf.hibernate.MappingException: Foreign key (clips [link_id])) must have same number of columns as the referenced primary key (links [link_cona_id,link_elr_name])
net.sf.hibernate.MappingException: Foreign key (clips [link_id])) must have same number of columns as the referenced primary key (links [link_cona_id,link_elr_name])
messages: [Ljava.lang.String;@922804
throwableCount: 1
throwables: [Ljava.lang.Throwable;@1815338