Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can't get one-to-many to auto-populate

 
Arnie Morein
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having a devil of a time getting the first (of several to come) one-to-many associations described and working. In this case, a report program needs to load a client's record and I want to have all the child table records loaded at the same time since I'm exporting the data to XML for processing with XSLT.

I've tried every version of the join I could gleen from the usual sources. Keep getting the "failed to ..." message (see below). This, despite the fact that I can see it read the client table and then the child barriers table right afterwards. What is it doing?

Anyone have any ideas? In this case, the client-barrier table is related to the client table via a FK of the client-id plus two other fields. Its a pretty complex mapping but a simple relationship otherwise.

Name and version of the database you are using: MSSQL 2000

Hibernate version: 3.2.0.ga

Mapping documents:



Code between sessionFactory.openSession() and session.close():

I'm using JBoss as the container, but here is the code where the error shows up:



The serializeToXml method accesses the Set and attempts to ge an iterator on it but finds NULL. Argh!

I've tried lots of different ways to "force" Hibernate to pre-populate the set, to no avail.

Full stack trace of any exception that occurs:
20:13:10,299 INFO [STDOUT] Hibernate: select ic.Client_ID, ic.Alt_Adrs_1, ic.Alt_Adrs_2, ic.Alt_City, ic.Alt_State, ic.Alt_ZIP,
ic.Annual_Income, ic.Below_Poverty, ic.Caseworker_ID,
icc.last_name + ', ' + icc.first_name as CaseWorkerName,
ic.Citizen_Status, cc.description as CitizenStatusString,
ic.Client_Hot_List, ic.Counselor_ID,
icc2.last_name + ', ' + icc2.first_name as CounselorName,
ic.Date_of_Last_Seizure, ic.Developmentally_Disabled, ic.DOB, ic.DOD,
ic.Emer_Contact, ic.Emer_Phone, ic.Ethnicity, ce.description as EthnicityDescription,
ic.Fax_Phone, ic.File_Locator,
ic.First_Name, ic.Gender, cg.description as GenderDescription,
ic.Hispanic_Descent, ic.Home_Is_TTY, ic.Home_Phone,
ic.Household_Size, ic.Income_Set, ic.Is_Closed, ic.Last_Name, ic.Maiden_Name,
ic.Mail_Adrs_1, ic.Mail_Adrs_2, ic.Mail_City, ic.Mail_State, ic.Mail_ZIP,
ic.Medications, ic.Middle_Name, ic.Mobile_Phone, ic.Multiple_Disabilities,
ic.Pager_Phone, ic.Path_Resume, ic.Physician_ID,
iphys.last_name + ', ' + iphys.first_name as PhysicianName,
ic.Preferred_Name, ic.Primary_Barrier, cb.description as PrimaryBarrierName,
ic.PS_AFDC, ic.PS_FS, ic.PS_Other, ic.PS_Sctn8, ic.PS_SS, ic.PS_SSDI, ic.PS_SSI,
ic.Secondary_Barrier, cb2.description as SecondaryBarrierName,
ic.Severely_Disabled, ic.SSN, ic.Status_Code, cs.description as StatusDescription,
ic.Work_Ext, ic.Work_Phone, ic.Who, ic.Last_Update, ic.comments, ic.email_address

from info_clients ic, codes_gender cg, info_company_contacts icc,
info_company_contacts icc2, codes_citizen cc, info_physicians iphys,
codes_barrier cb, codes_barrier cb2, codes_status cs,
codes_ethnicity ce

where ic.gender = cg.gender_code
and ic.caseworker_id = icc.contact_id
and ic.counselor_id = icc2.contact_id
and ic.citizen_status = cc.citizen_code
and ic.physician_id = iphys.physician_id
and ic.primary_barrier = cb.barrier
and ic.secondary_barrier = cb2.barrier
and ic.status_code = cs.status_code
and ic.ethnicity = ce.ethnicity
and client_id = ?
20:13:10,350 WARN [JDBCExceptionReporter] SQL Warning: 0, SQLState:
20:13:10,350 WARN [JDBCExceptionReporter] [Microsoft][SQLServer 2000 Driver for JDBC]Database changed to gwcts_centex
20:13:10,350 WARN [JDBCExceptionReporter] SQL Warning: 0, SQLState:
20:13:10,350 WARN [JDBCExceptionReporter] [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Changed database context to 'gwcts_centex'.
20:13:10,350 WARN [JDBCExceptionReporter] SQL Warning: 0, SQLState:
20:13:10,350 WARN [JDBCExceptionReporter] [Microsoft][SQLServer 2000 Driver for JDBC]Language changed to us_english
20:13:10,350 WARN [JDBCExceptionReporter] SQL Warning: 0, SQLState:
20:13:10,350 WARN [JDBCExceptionReporter] [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Changed language setting to us_english.
20:13:10,380 INFO [STDOUT] Hibernate: select cb.client_id, cb.barrier_id, cb.eap_data, cb.who, cb.last_update,
b.Description as description, b.Disability as disability
from info_client_barriers cb, codes_barrier b
where cb.barrier_id = b.barrier
and cb.client_id = ?
20:13:12,726 INFO [STDOUT] Hibernate: select cb.client_id, cb.barrier_id, cb.eap_data, cb.who, cb.last_update,
b.Description as description, b.Disability as disability
from info_client_barriers cb, codes_barrier b
where cb.barrier_id = b.barrier
and cb.client_id = ?
20:13:14,756 ERROR [[faces]] Servlet.service() for servlet faces threw exception
javax.faces.FacesException: Error calling action method of component with id reportForm:cmdRunReport
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
at javax.faces.component.UICommand.broadcast(UICommand.java:109)
at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.logipath.gict.cts.reporting.AuthorizationFilter.doFilter(AuthorizationFilter.java:57)
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.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
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.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
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:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
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(Thread.java:613)
Caused by: javax.faces.el.EvaluationException: Exception while invoking expression #{reportClient.runReport}
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:156)
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:61)
... 32 more
Caused by: java.lang.NullPointerException
at org.hibernate.collection.PersistentSet.isEmpty(PersistentSet.java:146)
at com.logipath.gict.cts.reporting.client.ReportClient.runReport(ReportClient.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:132)
... 33 more
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic