PDA

View Full Version : Problem in deploying Extjs-SpringMVC-Hibernate example



sachintaware
5 Mar 2012, 4:23 AM
Hello
I am working on a spring hibenrate extjs application and stuck at a point.
This is my js file for creating and displaying the content in a grid.
REFERENCE: http://loianegroner.com/2010/09/extjs-spring-mvc-3-and-hibernate-3-5-crud-datagrid-example/
I have created my own classes for hibernate and made the necessary changes and don't get any error(on execution) on the console but neither can i see the extjs grid with records.
Stack trace


Mar 5, 2012 5:32:03 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:/Program Files/Java/jre6/lib/i386;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;C:\apache-ant-1.6.5\bin;C:\Program Files\Subversion\bin;C:\GNUstep\mingw\bin;C:\GNUstep\GNUstep\System\Tools;C:\Program Files\Java\jdk1.6.0_24
Mar 5, 2012 5:32:04 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:StaffingApplication' did not find a matching property.
Mar 5, 2012 5:32:04 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-9191
Mar 5, 2012 5:32:04 PM org.apache.coyote.ajp.AjpProtocol init
INFO: Initializing Coyote AJP/1.3 on ajp-8009
Mar 5, 2012 5:32:04 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 825 ms
Mar 5, 2012 5:32:04 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 5, 2012 5:32:04 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.4
Mar 5, 2012 5:32:06 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'StaffingApplication'
Mar 5, 2012 5:32:06 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'StaffingApplication': initialization started
Mar 5, 2012 5:32:06 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'StaffingApplication-servlet': startup date [Mon Mar 05 17:32:06 IST 2012]; root of context hierarchy
Mar 5, 2012 5:32:06 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/app-config.xml]
Mar 5, 2012 5:32:07 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/db-config.xml]
Mar 5, 2012 5:32:07 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@12f9bcd: defining beans [candidatesController,candidatesDAO,candidatesService,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0,viewResolver,dataSource,sessionFactory,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,transactionManager]; root of factory hierarchy
Mar 5, 2012 5:32:07 PM org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName
INFO: Loaded JDBC driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
0 [main] INFO org.hibernate.cfg.annotations.Version - Hibernate Annotations 3.5.2-Final
19 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.5.2-Final
19 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
29 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
29 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
198 [main] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.2.0.Final
277 [main] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.options.model.Candidates
337 [main] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity com.options.model.Candidates on table HC_RESUME_BANK
436 [main] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.options.model.CandidateStatus
436 [main] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity com.options.model.CandidateStatus on table HC_REQ_RESUME
515 [main] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.options.model.Clients
515 [main] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity com.options.model.Clients on table HC_CLIENTS
515 [main] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.options.model.Requirements
515 [main] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity com.options.model.Requirements on table HC_REQUISITIONS
585 [main] INFO org.hibernate.cfg.annotations.CollectionBinder - Mapping collection: com.options.model.Requirements.candidateStatus -> HC_REQ_RESUME
585 [main] INFO org.hibernate.cfg.annotations.CollectionBinder - Mapping collection: com.options.model.Clients.require -> HC_REQUISITIONS
585 [main] INFO org.hibernate.cfg.annotations.CollectionBinder - Mapping collection: com.options.model.Candidates.candidateStats -> HC_REQ_RESUME
604 [main] INFO org.hibernate.cfg.AnnotationConfiguration - Hibernate Validator not found: ignoring
Mar 5, 2012 5:32:08 PM org.springframework.orm.hibernate3.LocalSessionFactoryBean buildSessionFactory
INFO: Building new Hibernate SessionFactory
624 [main] INFO org.hibernate.cfg.search.HibernateSearchEventListenerRegister - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
634 [main] INFO org.hibernate.connection.ConnectionProviderFactory - Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
1232 [main] INFO org.hibernate.cfg.SettingsFactory - RDBMS: Microsoft SQL Server, version: 9.00.1399
1232 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC driver: Microsoft SQL Server JDBC Driver 3.0, version: 3.0.1301.101
1262 [main] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.SQLServerDialect
1282 [main] INFO org.hibernate.transaction.TransactionFactoryFactory - Transaction strategy: org.springframework.orm.hibernate3.SpringTransactionFactory
1292 [main] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
1292 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
1292 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled
1292 [main] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled
1292 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): enabled
1292 [main] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto
1292 [main] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1
1292 [main] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
1292 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
1292 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled
1292 [main] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
1292 [main] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
1292 [main] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {}
1292 [main] INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: disabled
1292 [main] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled
1292 [main] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled
1292 [main] INFO org.hibernate.cfg.SettingsFactory - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
1292 [main] INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled
1292 [main] INFO org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled
1302 [main] INFO org.hibernate.cfg.SettingsFactory - Echoing all SQL to stdout
1302 [main] INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled
1302 [main] INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
1302 [main] INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo
1302 [main] INFO org.hibernate.cfg.SettingsFactory - Named query checking : enabled
1302 [main] INFO org.hibernate.cfg.SettingsFactory - Check Nullability in Core (should be disabled when Bean Validation is on): enabled
1362 [main] INFO org.hibernate.impl.SessionFactoryImpl - building session factory
1642 [main] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
Mar 5, 2012 5:32:09 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/candidates/view.action] onto handler [com.options.controller.CandidatesController@13ec758]
Mar 5, 2012 5:32:10 PM org.springframework.orm.hibernate3.HibernateTransactionManager afterPropertiesSet
INFO: Using DataSource [org.springframework.jdbc.datasource.DriverManagerDataSource@10704e1] of Hibernate SessionFactory for HibernateTransactionManager
Mar 5, 2012 5:32:10 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'StaffingApplication': initialization completed in 3705 ms
Mar 5, 2012 5:32:10 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-9191
Mar 5, 2012 5:32:10 PM org.apache.coyote.ajp.AjpProtocol start
INFO: Starting Coyote AJP/1.3 on ajp-8009
Mar 5, 2012 5:32:10 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 6401 ms






Ext.onReady(function(){

Ext.BLANK_IMAGE_URL = '/StaffingApplication/ext-3.2.1/resources/images/default/s.gif';

var Contact = Ext.data.Record.create([
{name: 'id'},
{
name: 'firstname',
type: 'string'
},{
name: 'lastname',
type: 'string'
},{
name: 'email',
type: 'string'
},{
name:'statusTitle',
type:'string'
},{
name:'clientName',
type:'string'
},{
name:'reqTitle',
type:'string'
}]);

var proxy = new Ext.data.HttpProxy({
api: {
read : 'candidates/view.action',

}
});

var reader = new Ext.data.JsonReader({
totalProperty: 'total',
successProperty: 'success',
idProperty: 'id',
root: 'data',
messageProperty: 'message' // <-- New "messageProperty" meta-data
},
Contact);

// The new DataWriter component.
var writer = new Ext.data.JsonWriter({
encode: true,
writeAllFields: true
});

// Typical Store collecting the Proxy, Reader and Writer together.
var store = new Ext.data.Store({
id: 'user',
proxy: proxy,
reader: reader,
writer: writer, // <-- plug a DataWriter into the store just as you would a Reader
autoSave: false // <-- false would delay executing create, update, destroy requests until specifically told to do so with some [save] buton.
});

//read the data from simple array
store.load();

Ext.data.DataProxy.addListener('exception', function(proxy, type, action, options, res) {
Ext.Msg.show({
title: 'ERROR',
msg: res.message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
});


var editor = new Ext.ux.grid.RowEditor({
saveText: 'Update'
});


// create grid
var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{header: "FIRSTNAME",
width: 170,
sortable: true,
dataIndex: 'firstname',
editor: {
xtype: 'textfield',
allowBlank: false
}},
{header: "LASTNAME",
width: 170,
sortable: true,
dataIndex: 'lastname',
editor: {
xtype: 'textfield',
allowBlank: false
}},
/*{header: "PHONE #",
width: 160,
sortable: true,
dataIndex: 'phone',
editor: {
xtype: 'textfield',
allowBlank: false
}}*/
{header: "EMAIL",
width: 170,
sortable: true,
dataIndex: 'email',
editor: {
xtype: 'textfield',
allowBlank: false
}},
{header: "Status",
width: 170,
sortable: true,
dataIndex: 'statusTitle',
editor: {
xtype: 'textfield',
allowBlank: false
}},
{header: "Clientname",
width: 170,
sortable: true,
dataIndex: 'clientName',
editor: {
xtype: 'textfield',
allowBlank: false
}},
{header: "Requirement",
width: 170,
sortable: true,
dataIndex: 'reqTitle',
editor: {
xtype: 'textfield',
allowBlank: false
}}
],
viewConfig:{forcefit:true},
plugins: [editor],
title: 'Candidates',
height: 500,
width:995,
frame:true,
tbar: [{
iconCls: 'icon-user-add',
text: 'Add Contact',
handler: function(){
var e = new Contact({
name: 'New Guy',
phone: '(000) 000-0000',
email: 'new@loianetest.com',
contact_address:'Street,State'
});
editor.stopEditing();
store.insert(0, e);
grid.getView().refresh();
grid.getSelectionModel().selectRow(0);
editor.startEditing(0);
}
},{
iconCls: 'icon-user-delete',
text: 'Remove Contact',
handler: function(){
editor.stopEditing();
var s = grid.getSelectionModel().getSelections();
for(var i = 0, r; r = s[i]; i++){
store.remove(r);
}
}
},{
iconCls: 'icon-user-save',
text: 'Save All Modifications',
handler: function(){
store.save();
}
}]
});

//render to DIV
grid.render('crud-grid');
});

JSP file index.jsp to render the extjs widjets.


<html>
<head>
<title>Staffing Application</title>

<!-- ExtJS css -->
<link rel="stylesheet" type="text/css" href="/StaffingApplication/ext-3.2.1/resources/css/ext-all.css" />

<!-- Row Editor plugin css -->
<link rel="stylesheet" type="text/css" href="/StaffingApplication/ext-3.2.1/examples/ux/css/rowEditorCustom.css" />
<link rel="stylesheet" type="text/css" href="/StaffingApplication/ext-3.2.1/examples/shared/examples.css" />
<link rel="stylesheet" type="text/css" href="/StaffingApplication/ext-3.2.1/examples/ux/css/RowEditor.css" />

<!-- App custom css -->
<link rel="stylesheet" type="text/css" href="/StaffingApplication/css/crudgrid.css" />

<!-- ExtJS js -->
<script src="/StaffingApplication/ext-3.2.1/adapter/ext/ext-base.js"></script>
<script src="/StaffingApplication/ext-3.2.1/ext-all.js"></script>

<!-- Row Editor plugin js -->
<script src="/StaffingApplication/ext-3.2.1/examples/ux/RowEditor.js"></script>

<!-- App js -->
<script src="/StaffingApplication/js/crud-grid.js"></script>

</head>
<body></body>
</html>


web.xml


<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">

<display-name>StaffingApplication</display-name>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

<servlet>
<servlet-name>StaffingApplication</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring/app-config.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>StaffingApplication</servlet-name>
<url-pattern>*.action</url-pattern>
</servlet-mapping>

</web-app>


My Controller class


package com.options.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


import com.options.model.Candidates;
import com.options.service.CandidatesService;

@Controller
public class CandidatesController {


private CandidatesService candidatesService;

@RequestMapping(value="/candidates/view.action")
public @ResponseBody Map<String,? extends Object> view() throws Exception {

try{
List<Candidates> candidates = candidatesService.getCandidatesList();
return getMap(candidates);

} catch (Exception e) {

return getModelMapError("Error retrieving Candidates from database.");
}
}
private Map<String,Object> getMap(List<Candidates> candidates){

Map<String,Object> modelMap = new HashMap<String,Object>(3);
modelMap.put("total", candidates.size());
modelMap.put("data", candidates);
modelMap.put("success", true);
return modelMap;
}

private Map<String,Object> getModelMapError(String msg){

Map<String,Object> modelMap = new HashMap<String,Object>(2);
modelMap.put("message", msg);
modelMap.put("success", false);

return modelMap;
}

@Autowired
public void setCandidatesService(CandidatesService candidatesService) {
this.candidatesService = candidatesService;
}

}


DAO class



import com.options.model.Candidates;

@Repository
public class CandidatesDAO implements ICandidatesDAO {

private HibernateTemplate hibernateTemplate;
@Autowired
public void setSessionFactory(SessionFactory sessionFactory) {
hibernateTemplate = new HibernateTemplate(sessionFactory);
}

@SuppressWarnings("unchecked")
@Override
public List<Candidates> getCandidates() {
//String hql="SELECT Contact_email,contact_name,contact_phone,id,contact_details.contact_address FROM CONTACT,CONTACT_DETAILS where CONTACT.CONTACT_ID=CONTACT_DETAILS.ID";
//return (List<Contact>) hibernateTemplate.getSessionFactory().getCurrentSession().createSQLQuery("select c.contact_id,c.contact_name,c.contact_email,c.contact_phone from contact c");
return hibernateTemplate.find("from Candidates");
}


One of the Model classes


package com.options.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import javax.persistence.CascadeType;

import org.codehaus.jackson.annotate.JsonAutoDetect;

import com.options.controller.CandidatesController;

@JsonAutoDetect
@Entity
@Table(name="BANK_TABLE")
public class Candidates{


private int id;
private String firstName;
private String lastName;
private String email;

private Set<CandidateStatus> candidateStats = new HashSet<CandidateStatus>(0);


@OneToMany //(mappedBy="candidate")
@JoinColumn(name="ResID",nullable=false,referencedColumnName="RID")
public Set<CandidateStatus> getCandidateStats() {
return candidateStats;
}
public void setCandidateStats(Set<CandidateStatus> candidateStats) {
this.candidateStats = candidateStats;
}



@Id
@Column(name="RID")
public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

@Column(name="FirstName")
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}

@Column(name="LastName")
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}

@Column(name="EmailID")
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}


}



app-config.xml(Spring config)


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">

<!-- Scans the classpath of this application for @Components to deploy as beans -->
<!-- Annotated controller beans may be defined explicitly, using a standard Spring bean definition in the
dispatcher's context. However, the @Controller stereotype also allows for autodetection, aligned with Spring 2.5's
general support for detecting component classes in the classpath and auto-registering bean definitions for them. -->

<context:component-scan base-package="com.options" />

<!-- Configures the @Controller programming model -->
<mvc:annotation-driven />

<!-- misc -->
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="suffix" value=".jsp"/>
</bean>

<!-- Configures Hibernate - Database Config -->
<import resource="db-config.xml" />

</beans>


db-config.xml


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName"><value>com.microsoft.sqlserver.jdbc.SQLServerDriver</value></property>
<property name="url"><value>jdbc:sqlserver://localhost:1433;databaseName=hd</value></property>
<property name="username"><value>root</value></property>
<property name="password"><value>root</value></property>
</bean>


<!-- Hibernate SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource"><ref local="dataSource"/></property>
<property name="packagesToScan" value="com.options.model" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<!-- <prop key="hibernate.hbm2ddl.auto">create</prop>-->
</props>
</property>
</bean>

<!-- Transaction manager for a single Hibernate SessionFactory (alternative to JTA) -->
<tx:annotation-driven/>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory"><ref local="sessionFactory"/></property>
</bean>

</beans>




Can anybody help out with the mstake.I am a newbie trying springmvc-hibernate and used extjs with servlets previously.
Any help would be appreciated.

Regards
Sach
www.optionsconsultancy.com

friend
5 Mar 2012, 4:48 AM
As a quick test to make sure that the serverside is actually returning JSON, call your request URL directly from the browser's address bar. This should stream the desired JSON to your browser:



http://localhost:8080/StaffingApplication/candidates/view.action


If you aren't getting JSON output, then make sure that you have the Jackson Mapper (http://wiki.fasterxml.com/JacksonDownload) libraries in WEB-INF/lib.

sachintaware
5 Mar 2012, 9:31 PM
@friend
Thank you for the tip.It helped me to find the exact error.I have the jackson jars in the build path of the project,but i get two errors and i am not sure if it is related to jackson(json) alone.

One is related to hibernate and other json.Adding the stacktrace below.Would be helpful if you can throw some light over it.
I get this when i hit the URL suggested by you.



Hibernate: select candidates0_.RID as RID0_, candidates0_.EmailID as EmailID0_, candidates0_.FirstName as FirstName0_, candidates0_.LastName as LastName0_ from BANK_TABLE candidates0_
19006 [http-9191-exec-3] ERROR org.hibernate.LazyInitializationException - failed to lazily initialize a collection of role: com.options.model.Candidates.candidateStats, no session or session was closed
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.options.model.Candidates.candidateStats, no session or session was closed
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:380)
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:372)
at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:365)
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:108)
at org.hibernate.collection.PersistentSet.iterator(PersistentSet.java:186)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:128)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:117)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.ContainerSerializers$IndexedListSerializer.serialize(ContainerSerializers.java:78)
at org.codehaus.jackson.map.ser.ContainerSerializers$IndexedListSerializer.serialize(ContainerSerializers.java:44)
at org.codehaus.jackson.map.ser.MapSerializer.serializeEntries(MapSerializer.java:131)
at org.codehaus.jackson.map.ser.MapSerializer.serialize(MapSerializer.java:74)
at org.codehaus.jackson.map.ser.MapSerializer.serialize(MapSerializer.java:19)
at org.codehaus.jackson.map.ser.StdSerializerProvider._serializeValue(StdSerializerProvider.java:260)
at org.codehaus.jackson.map.ser.StdSerializerProvider.serializeValue(StdSerializerProvider.java:212)
at org.codehaus.jackson.map.ObjectMapper.writeValue(ObjectMapper.java:694)
at org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.writeInternal(MappingJacksonHttpMessageConverter.java:145)
at org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:181)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodInvoker.writeWithMessageConverters(AnnotationMethodHandlerAdapter.java:933)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodInvoker.handleResponseBody(AnnotationMethodHandlerAdapter.java:898)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodInvoker.getModelAndView(AnnotationMethodHandlerAdapter.java:843)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:423)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:409)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:203)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:379)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:242)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:259)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:281)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Mar 6, 2012 10:45:47 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet in context with path threw exception
org.codehaus.jackson.map.JsonMappingException: failed to lazily initialize a collection of role: com.options.model.Candidates.candidateStats, no session or session was closed (through reference chain: java.util.HashMap["data"]->java.util.ArrayList[0]->com.options.model.Candidates["candidateStats"])
at org.codehaus.jackson.map.JsonMappingException.wrapWithPath(JsonMappingException.java:214)
at org.codehaus.jackson.map.JsonMappingException.wrapWithPath(JsonMappingException.java:179)
at org.codehaus.jackson.map.ser.SerializerBase.wrapAndThrow(SerializerBase.java:80)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:127)
at org.codehaus.jackson.map.ser.ContainerSerializers$IndexedListSerializer.serialize(ContainerSerializers.java:78)
at org.codehaus.jackson.map.ser.ContainerSerializers$IndexedListSerializer.serialize(ContainerSerializers.java:44)
at org.codehaus.jackson.map.ser.MapSerializer.serializeEntries(MapSerializer.java:131)
at org.codehaus.jackson.map.ser.MapSerializer.serialize(MapSerializer.java:74)
at org.codehaus.jackson.map.ser.MapSerializer.serialize(MapSerializer.java:19)
at org.codehaus.jackson.map.ser.StdSerializerProvider._serializeValue(StdSerializerProvider.java:260)
at org.codehaus.jackson.map.ser.StdSerializerProvider.serializeValue(StdSerializerProvider.java:212)
at org.codehaus.jackson.map.ObjectMapper.writeValue(ObjectMapper.java:694)
at org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.writeInternal(MappingJacksonHttpMessageConverter.java:145)
at org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:181)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodInvoker.writeWithMessageConverters(AnnotationMethodHandlerAdapter.java:933)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodInvoker.handleResponseBody(AnnotationMethodHandlerAdapter.java:898)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodInvoker.getModelAndView(AnnotationMethodHandlerAdapter.java:843)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:423)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:409)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:203)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:379)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:242)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:259)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:281)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.options.model.Candidates.candidateStats, no session or session was closed
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:380)
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:372)
at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:365)
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:108)
at org.hibernate.collection.PersistentSet.iterator(PersistentSet.java:186)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:128)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:117)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
... 35 more



Any changes to the DAO needed as the session error is beng thrown.?I have added the dao in the frst post for reference.

Thanks and Regards
sach
www.optionsconsultancy.com (http://www.optionsconsultancy.com/)

sachintaware
6 Mar 2012, 3:00 AM
Also,friend
I am having multiple tables in the application(4 to be precise.)
And I am quite sure this must be causing error.I want the data from all 4 tables joined together using Hibernate annotations.
Please,suggest some steps,tutorials to move forward.

Thanks
Sach
www.optionsconsultancy.com (http://www.optionsconsultancy.com/)

friend
6 Mar 2012, 4:42 AM
LazyInit is a common Hibernate issue where mapped child collections are lazy-loaded by default. You'll get better help with this issue by searching/posting in the Hibenate and/or Spring Forums.

As a helpful hint, try the search terms OpenSessionInViewInterceptor or OpenSessionInViewFilter.

sachintaware
6 Mar 2012, 5:03 AM
Hey thanks friend,
I was able to get around the lazy load issue using Hibernate.initialize();
But jackson seams to be troubling me still.
Here's the stacktrace that i get now.
Though I get the json file on hitting the url its not appropriate.

I think i am close and would like to know what i may be doing wrong.



at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:151)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:117)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:151)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:117)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:151)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:117)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:151)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:117)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:151)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:117)

börn
6 Mar 2012, 6:54 AM
that's not the complete stacktrace, isn't it? What's the correct exception name and so on? For Jackson there is a hibernate module (just google it - there is maven dep as well), which you can configure in your object mapper ... i have extended object mapper and configure that with registerModule in the constructor.

That works very fine for me... but you have to make sure that all objects you want to present or serialize into json are initialized in your controller. In Fact you have to iterate through your collections (persistant-bags). I don't think it will be enough to just call initialize on the collection (the items itself are lazy).

All those attributes you don't need at the client (not initialized) are considered as null values by the hibernate-module of jackson and therefor not serialized into json.

friend
6 Mar 2012, 9:15 AM
The Spring Framework already has a Jackson-based View Resolver built-in, so you'll want to avoid the Hibernate module lest you run into conflicts.

Instead of Hibernate.initialize(), consider using the various @Fetch annotations in your Model classes to specify how child collections should be handled.

börn
6 Mar 2012, 10:45 PM
erm... no. The spring framework has a jackson view resolver, which acutally uses a instance of a object mapper. Which object mapper one use you can configure in your spring configuration and of course you can also configure the hibernate-module as part of jackson - this won't get you into conflict with spring. I actually have that configuration running with spring. I also did some changes on the bean-deserializer of jackson because of the json structure extjs wants - no problems with spring here...

Reconfiguring your jpa/hibernate beans to always catch eagerly isn't the right solution... or at least should not be ;)

sachintaware
7 Mar 2012, 12:37 AM
Thank you born and friend for sharing your views and guiding me.
I am still stuck and hence adding my model classes.I tried using the @Fetch(FetchMode.JOIN) as suggested by friend but still not getting it to work.

Other way round I tried(break down the problem) to fetch only a SINGLE class with annotations and worked easily giving me the required JSON.

Now I am back to using joins (probably unaware of the best way to do it) and again facing the same issue.

Here adding my models for reference and the DAO.

CandidateStatus.java


@Entity
@Table(name="HC_REQ_RESUME")

public class CandidateStatus{

private int id;
private String statusTitle;
private Candidates candidate;
private int reqid;

public int getReqid() {
return reqid;
}

public void setReqid(int reqid) {
this.reqid = reqid;
}

@ManyToOne //(fetch = FetchType.LAZY,cascade=CascadeType.ALL,targetEntity=Candidates.class)
@Fetch(FetchMode.JOIN)
@JoinColumn(name="ResID",insertable=false,updatable=false)
@ForeignKey(name = "FK_ResID")
public Candidates getCandidate() {
return candidate;
}

public void setCandidate(Candidates candidate) {
this.candidate = candidate;
}

@Id
@Column(name="RID",insertable=false,updatable=false)
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}

@Column(name="StatusTitle")

public String getStatusTitle() {
return statusTitle;
}
public void setStatusTitle(String statusTitle) {
this.statusTitle = statusTitle;
}

}



Candidate.java


@JsonAutoDetect
@Entity
@Table(name="HC_RESUME_BANK")
public class Candidates{

private int id;
private String firstName;
private String lastName;
private String email;

private Set<CandidateStatus> candidateStats = new HashSet<CandidateStatus>(0);

@OneToMany //(mappedBy="candidate")
@Fetch(FetchMode.JOIN)
@JoinColumn(name="ResID",nullable=false,referencedColumnName="RID")

public Set<CandidateStatus> getCandidateStats() {
return candidateStats;
}
public void setCandidateStats(Set<CandidateStatus> candidateStats) {
this.candidateStats = candidateStats;
}

@Id
@Column(name="RID")
public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

@Column(name="FirstName")
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}

@Column(name="LastName")
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}

@Column(name="EmailID")
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}

}


DAO


@Repository
public class CandidatesDAO implements ICandidatesDAO {

private HibernateTemplate hibernateTemplate;
@Autowired
public void setSessionFactory(SessionFactory sessionFactory) {
hibernateTemplate = new HibernateTemplate(sessionFactory);

}

@SuppressWarnings("unchecked")
@Override
public List<Candidates> getCandidates() {

return hibernateTemplate.find("from Candidates"); //This should return values of both tables using join
}


Can you suggest what should be the exact way of acheving it?Do i have to write a explicit join query?
I am not able to find any examples based on it,so any details would be helpful.

I am using an existing database so i have to use the keys that exist in the database and cannot build a join table.
I have my spring config file configured(Posted earlier).I am using spring3.1 hibernate 4 and extjs3.2.1

Regards
Sach

börn
7 Mar 2012, 1:57 AM
okay... it shouldn't be the best solution to get rid of your hibernate proxies by joining them or fetching collections eagerly - you've seen that already.

Give it a try:
https://github.com/FasterXML/jackson-module-hibernate

t (https://github.com/FasterXML/jackson-module-hibernate)herefore you have to give up the automatic configuration:

<mvc:annotation-driven />
but it should work manually as well (take care - it's a spring 3.0 config - haven't tested it on 3.1 yet):



[...]

<!-- your static resources goes into here... -->
<mvc:resources mapping="/resources/**" location="/resources/"/>

<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/>
</bean>


<!-- using spring-mvc with annotations -->
<bean name="handlerMapping"
class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<property name="defaultHandler" ref="annotationMethodHandlerAdapter"/>
</bean>

<bean name="annotationMethodHandlerAdapter"
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters">
<bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
<property name="objectMapper" ref="myObjectMapper"/>
</bean>
</property>
</bean>


<bean id="myObjectMapper" class="com.acme.MyObjectMapper"/>


<context:component-scan base-package="com.acme.services"/>


After configuring that you have to implement your "MyObjectMapper" as described in the readme of the hibernate-module i mentioned above.

That should solve your problems... or at least the one you described... - i don't know exactly the kind of exception you received yet, so it's kinda guessing here...

börn
7 Mar 2012, 2:02 AM
by the way... when using hql I think the behavior is that it overrides the domain-configuration. I suggest a template.find - list? method (haven't used the template for long). Or using criteria or fetch joining explicitly in hql.

sachintaware
7 Mar 2012, 2:22 AM
Sorry I missed posting the entire stack trace..
Here it is.


SEVERE: Servlet.service() for servlet in context with path threw exception
org.codehaus.jackson.map.JsonMappingException: Infinite recursion (StackOverflowError) (through reference chain: com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"]->org.hibernate.collection.PersistentSet[0]->com.options.model.CandidateStatus["candidate"]->com.options.model.Candidates["candidateStats"])
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:133)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:151)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:117)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:151)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:117)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:151)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:117)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:151)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:117)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:151)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:117)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:151)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:117)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:151)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:117)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:151)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:117)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:151)
at org.codehaus.jackson.map.ser.ContainerSerializers$CollectionSerializer.serialize(ContainerSerializers.java:117)
at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:218)
at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:122)


This i am getting for the above posted classes.I get the JSON but not the right one,with improper formatting.

I will give the above mentioned method by you, a try.Also,will changing the query by writing explcit join
help?And if we have to write a query explicitly then what's the purpose of Hibernate??Sorry if sounding stupid. :P

Regards
Sach

sachintaware
7 Mar 2012, 2:47 AM
I kept hibernate.show_sql property to true and got the queries causing error.I have highlighted it in the stack trace.



Hibernate: select candidates0_.ReqID as ReqID3_2_, candidates0_.RID as RID2_, candidates0_.RID as RID1_1_, candidates0_.ResID as ResID1_1_, candidates0_.reqid as reqid1_1_, candidates0_.ReqID as ReqID1_1_, candidates0_.StatusTitle as StatusTi3_1_1_, candidates1_.RID as RID0_0_, candidates1_.EmailID as EmailID0_0_, candidates1_.FirstName as FirstName0_0_, candidates1_.LastName as LastName0_0_ from HC_REQ_RESUME candidates0_ left outer join HC_RESUME_BANK candidates1_ on candidates0_.ResID=candidates1_.RID where candidates0_.ReqID=?
Hibernate: select require0_.ClientID as ClientID2_1_, require0_.RID as RID1_, require0_.RID as RID3_0_, require0_.ClientID as ClientID3_0_, require0_.ReqTitle as ReqTitle3_0_ from HC_REQUISITIONS require0_ where require0_.ClientID=?
Hibernate: select candidates0_.ReqID as ReqID3_2_, candidates0_.RID as RID2_, candidates0_.RID as RID1_1_, candidates0_.ResID as ResID1_1_, candidates0_.reqid as reqid1_1_, candidates0_.ReqID as ReqID1_1_, candidates0_.StatusTitle as StatusTi3_1_1_, candidates1_.RID as RID0_0_, candidates1_.EmailID as EmailID0_0_, candidates1_.FirstName as FirstName0_0_, candidates1_.LastName as LastName0_0_ from HC_REQ_RESUME candidates0_ left outer join HC_RESUME_BANK candidates1_ on candidates0_.ResID=candidates1_.RID where candidates0_.ReqID=?
Hibernate: select candidates0_.ReqID as ReqID3_2_, candidates0_.RID as RID2_, candidates0_.RID as RID1_1_, candidates0_.ResID as ResID1_1_, candidates0_.reqid as reqid1_1_, candidates0_.ReqID as ReqID1_1_, candidates0_.StatusTitle as StatusTi3_1_1_, candidates1_.RID as RID0_0_, candidates1_.EmailID as EmailID0_0_, candidates1_.FirstName as FirstName0_0_, candidates1_.LastName as LastName0_0_ from HC_REQ_RESUME candidates0_ left outer join HC_RESUME_BANK candidates1_ on candidates0_.ResID=candidates1_.RID where candidates0_.ReqID=?
Hibernate: select require0_.ClientID as ClientID2_1_, require0_.RID as RID1_, require0_.RID as RID3_0_, require0_.ClientID as ClientID3_0_, require0_.ReqTitle as ReqTitle3_0_ from HC_REQUISITIONS require0_ where require0_.ClientID=?
Hibernate: select candidates0_.ReqID as ReqID3_2_, candidates0_.RID as RID2_, candidates0_.RID as RID1_1_, candidates0_.ResID as ResID1_1_, candidates0_.reqid as reqid1_1_, candidates0_.ReqID as ReqID1_1_, candidates0_.StatusTitle as StatusTi3_1_1_, candidates1_.RID as RID0_0_, candidates1_.EmailID as EmailID0_0_, candidates1_.FirstName as FirstName0_0_, candidates1_.LastName as LastName0_0_ from HC_REQ_RESUME candidates0_ left outer join HC_RESUME_BANK candidates1_ on candidates0_.ResID=candidates1_.RID where candidates0_.ReqID=?
Mar 7, 2012 4:09:29 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet in context with path threw exception
org.codehaus.jackson.map.JsonMappingException: Infinite recursion (StackOverflowError) (through reference chain: com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]
->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"]->org.hibernate.collection.PersistentSet[0]->com.options.model.Requirements["client"]->com.options.model.Clients["require"])


Regards
Sach

börn
7 Mar 2012, 2:47 AM
Ah okay - i see... you have a recursion. JSON shouldn't have cycles in it's object graphs (actually it is more of a tree). You can avoid that by using a Annotation @JsonIgnore at the back-reference. ~o)

sachintaware
7 Mar 2012, 3:17 AM
That did the trick,I got rid of the exception and getting the json in the correct format atleast(though not correct by content.)

Now this is the query returned and it shows performing the join operation,but in the JSON i get entities of only one class\:D/.(the one in .find("from candidates")).Why can this happen??



Hibernate: select candidates0_.RID as RID0_1_, candidates0_.EmailID as EmailID0_1_, candidates0_.FirstName as FirstName0_1_, candidates0_.LastName as LastName0_1_, candidates1_.ResID as ResID0_3_, candidates1_.RID as RID3_, candidates1_.RID as RID1_0_, candidates1_.ResID as ResID1_0_, candidates1_.reqid as reqid1_0_, candidates1_.StatusTitle as StatusTi3_1_0_ from HC_RESUME_BANK candidates0_ left outer join HC_REQ_RESUME candidates1_ on candidates0_.RID=candidates1_.ResID where candidates0_.RID=?


Thanks
Sach

börn
7 Mar 2012, 3:25 AM
hmm.. good question. I think you have to debug that.. - make some breakpoints after you received your objects from the query and inspect your objects, whether they have the missing collection... maybe they are still lazy? look at the hibnernate-proxy... - also make breakpoints in the hibernate-module classes while serializing the json and take a look what's going on.

sachintaware
7 Mar 2012, 3:54 AM
@born
Just a question out of curiosity!!!!!!!Shouldn't that gve me the famous lazy load exception??
Working on your suggested tracks!!Wll get back soon!

Thanks
Sach

börn
7 Mar 2012, 5:14 AM
no... that's the clue with the hibernate module. It's responsible for ignoring all those collections with uninitialized proxies... so if you don't catch collections eagerly or calling them in the controller (traversing with foreach!) they won't be initialized and therefore the jackson hibernate module skips all those collections (don't calling the getter) so the serialized object doesn't contain those collections which only would produce a lazy-initialization-exception.

I hope that you put the @JsonIgnore Annotation at
CandidateStatus property for the candidates?

sachintaware
7 Mar 2012, 5:34 AM
yes I had it at the method level,but above the @JoinColumn().

not sure if that can cause a problem???

sachintaware
7 Mar 2012, 5:38 AM
Asking for a favour.!!
Also if possible can you just give me example for joining two tables in hibernate without a join table on existing keys.
My table structure is like this:
The table structure is as follows:




Table1 Table2 Table3 Table4
Id Id Id Id
field1 field1(PK to Table1) field1 field1 (PK to table 2)
field2 (PK to table 3)


I think that will help me to resolve the whole lazy load issue with the proxies.

Thanks for your valuable time and guidance.

börn
7 Mar 2012, 10:41 PM
Didn't get this... the @JoinColumn is the right way to join another class without a association table. If you want to have join tables you have to use @JoinTable (look at hibernate documentation) with your @OneToMany.

Besides - I don't think, that you have to use
referencedColumnName="RID". Per Default hibernate refers to the primary key of the destination table.

And the way you declare your hibernate objects doesn't have anything to do with your problem(s).

sachintaware
8 Mar 2012, 10:56 PM
@born
I got your point and that means I have got my model classes right.I am just not able to get the join correct(i mean query).
In my DAO
when i have this query it works but fetches details of only one table.


@SuppressWarnings("unchecked")
@Override
public List<Candidates> getCandidates() {

return hibernateTemplate.find("from CandidateStatus ");
}

When I give a explicit join it gives me the error in my catch block as "Cannot get records from db"


public List<Candidates> getCandidates() {

return hibernateTemplate.find("select cands.firstname,cands.lastname,cands.email from Candidates as cands inner join cands.CandidateStatus as candstat where cands.id = candstat.resid");

}


Also,i tried to use createQuery()


private SessionFactory sessionFactory;

@SuppressWarnings("unchecked")
@Override
public List<Candidates> getCandidates() {
// TODO Auto-generated method stub
Session session = sessionFactory.getCurrentSession();

Query query = session.createQuery("from Candidates");
return query.list();

}


but this too lands into same error as above.
when I search for query syntax i found mine is correct(atleast the first 2 of above).
I mean either I should get both the tables data or no data.So,what can be the right query for it?

I have attached the eclipse project alongwith the post for reference.

Thanks
Sach
www.optionsconsultancy.com

börn
9 Mar 2012, 12:31 AM
i think your hql have to look something like this:

from Candidates as cands inner join fetch cands.candidateStats

you don't have to use sql - where-joining syntax here (take a look at the hibernate-docu).

and - exactly like this.. - if you use "from Candidates" - the hql says you want only the candidates, it ignores the setting in the domain class. If you use a loadAll(Candidates.class) - it should use the configuration at the domain class by returning all Candidates with your candidateStats.

you may also use the criteria api... i think this works also with the domain-configuration while hql is overriding this (airc).

sachintaware
9 Mar 2012, 11:19 PM
@born
Thank you for the corrections.Now,when I use the one suggested by you i.e


from Candidates as cands inner join fetch cands.candidateStats

This uses a join fetch.But i get the result only from a single table and the resultant query looks like this


Hibernate: select candidates0_.RID as RID0_0_, candidates1_.RID as RID1_1_, candidates0_.EmailID as EmailID0_0_, candidates0_.FirstName as FirstName0_0_, candidates0_.LastName as LastName0_0_, candidates1_.ResID as ResID1_1_, candidates1_.reqid as reqid1_1_, candidates1_.resid as resid1_1_, candidates1_.StatusTitle as StatusTi4_1_1_, candidates1_.ResID as ResID0_0__, candidates1_.RID as RID0__ from HC_RESUME_BANK candidates0_ inner join HC_REQ_RESUME candidates1_ on candidates0_.RID=candidates1_.ResID

which has a join.

Now,i tried the same query without the fetch

from Candidates as cands inner join cands.candidateStats

and I get N+1 queries and results from both tables.

Now before troubling you I went through the "Fetching Strategies" documentation and learnt this.
A "fetch" join allows associations or collections of values to be initialized along with their parent objects using a single select. This is particularly useful in the case of a collection. It effectively overrides the outer join and lazy declarations of the mapping file for associations and collections

So,fetch should overcome the lazy load issue and give me correct results.But not happening.

I can bear with the N+1 problem for now and hence kept the query which worked for now.
But,now when my programs loaded everything happens fine but I can't see the GRID with content.I checked the Json returned and it is in the correct format.
Example record returned:


[
{
"id": 374,
"reqid": 121,
"statusTitle": "CV-Sent"
},
{
"id": 9614,
"firstName": "Thube",
"lastName": "Chandrakant",
"email": "satish.thube@gmail.com;satishthube@shreya.co.in"
},
{
"id": 121,
"client": {
"id": 25,
"clientName": "Bilcare"
},
"clientId": 25,
"reqTitle": "QA excutive"
}
],


My extjs javascript file,the property names are same n both the json and js file,but still the grid is not displayed(Not even a blank grid).



Ext.onReady(function(){

Ext.BLANK_IMAGE_URL = '/StaffingApplication/ext-3.2.1/resources/images/default/s.gif';

var Contact = Ext.data.Record.create([
{name: 'id'},
{
name: 'firstName',
type: 'string'
},{
name: 'lastName',
type: 'string'
},{
name: 'email',
type: 'string'
},{
name:'statusTitle',
type:'string'
},{
name:'clientName',
type:'string'
},{
name:'reqTitle',
type:'string'
}]);

var proxy = new Ext.data.HttpProxy({
api: {
read : 'candidates/view.action',

}
});

var reader = new Ext.data.JsonReader({
totalProperty: 'total',
successProperty: 'success',
idProperty: 'id',
root: 'data',
messageProperty: 'message' // <-- New "messageProperty" meta-data
},
Contact);

// The new DataWriter component.
var writer = new Ext.data.JsonWriter({
encode: true,
writeAllFields: true
});

// Typical Store collecting the Proxy, Reader and Writer together.
var store = new Ext.data.Store({
id: 'user',
proxy: proxy,
reader: reader,
writer: writer, // <-- plug a DataWriter into the store just as you would a Reader
autoSave: false // <-- false would delay executing create, update, destroy requests until specifically told to do so with some [save] buton.
});

//read the data from simple array
store.load();

Ext.data.DataProxy.addListener('exception', function(proxy, type, action, options, res) {
Ext.Msg.show({
title: 'ERROR',
msg: res.message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
});


var editor = new Ext.ux.grid.RowEditor({
saveText: 'Update'
});


// create grid
var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{header: "FIRSTNAME",
width: 170,
sortable: true,
dataIndex: 'firstName',
editor: {
xtype: 'textfield',
allowBlank: false
}},
{header: "LASTNAME",
width: 170,
sortable: true,
dataIndex: 'lastName',
editor: {
xtype: 'textfield',
allowBlank: false
}},
/*{header: "PHONE #",
width: 160,
sortable: true,
dataIndex: 'phone',
editor: {
xtype: 'textfield',
allowBlank: false
}}*/
{header: "EMAIL",
width: 170,
sortable: true,
dataIndex: 'email',
editor: {
xtype: 'textfield',
allowBlank: false
}},
{header: "Status",
width: 170,
sortable: true,
dataIndex: 'statusTitle',
editor: {
xtype: 'textfield',
allowBlank: false
}},
{header: "Clientname",
width: 170,
sortable: true,
dataIndex: 'clientName',
editor: {
xtype: 'textfield',
allowBlank: false
}},
{header: "Requirement",
width: 170,
sortable: true,
dataIndex: 'reqTitle',
editor: {
xtype: 'textfield',
allowBlank: false
}}
],
viewConfig:{forcefit:true},
plugins: [editor],
title: 'Candidates',
height: 500,
width:995,
frame:true,
tbar: [{
iconCls: 'icon-user-add',
text: 'Add Contact',
handler: function(){
var e = new Contact({
name: 'New Guy',
phone: '(000) 000-0000',
email: 'new@loianetest.com',
contact_address:'Street,State'
});
editor.stopEditing();
store.insert(0, e);
grid.getView().refresh();
grid.getSelectionModel().selectRow(0);
editor.startEditing(0);
}
},{
iconCls: 'icon-user-delete',
text: 'Remove Contact',
handler: function(){
editor.stopEditing();
var s = grid.getSelectionModel().getSelections();
for(var i = 0, r; r = s[i]; i++){
store.remove(r);
}
}
},{
iconCls: 'icon-user-save',
text: 'Save All Modifications',
handler: function(){
store.save();
}
}]
});

//render to DIV
grid.render('crud-grid');
});

I hope this will solve the entire thing and I can get it working.

Thanks and Regards
Sach
www.optionsconsultancy.com

börn
12 Mar 2012, 2:05 AM
Hmm.. the join thing is quite funny... don't see why the fetch doesn't work.

do you have a reader configured? do you see any js errors om the console? i also expect a response like:
{data: [...], success:true} from the server and therefore you need something like

reader : { type : 'json',
root : 'data'
}

at your store... besides... You're using Ext 3, aren't you? This is the 4.x forum ;)

sachintaware
12 Mar 2012, 2:38 AM
Oops!!!It seems i made a blunder of it!!I will have to move to 4.x in the near future.This is a study and I didn't wanted to get into 4.x without hands on 3.x

But just try to correct me here.This is the reader:


var reader = new Ext.data.JsonReader({
totalProperty: 'total',
successProperty: 'success',
idProperty: 'id',
root: 'data',
messageProperty: 'message' // <-- New "messageProperty" meta-data
},
Contact);


This is a JSON reader so is it necessary to add " type:json"?
In firebug i get the Json correctly under the JSON tab and the response tab.

Json returned in the response tab.



{"data":[[322,"Bandi","Reddy","vasanth@gmail.com","Shortlisted","Capgemini","Perl Developer"],[323,"Dinesh","Lima","dineshlima@gmail.com","Shortlisted","Capgemini","Perl Developer"],[324,"Naveen","Reddy","naveenreddyperl@gmail.com","Shortlisted","Capgemini","Perl Developer"]],"total":7668,"success":true}


Sach

börn
12 Mar 2012, 6:19 AM
yap okay - looks right. And what's in the store? Try to get it with the storemanager and look into the data of the store - it should also have something like rawData in the reader of the store...

sachintaware
12 Mar 2012, 10:03 PM
Here's the store.I get a empty grid now with a scroll bar,which suggests that the records are loaded(i suppose) but not displayed..
I have posted the entire file in the post before this.


var store = new Ext.data.Store({
id: 'user',
proxy: proxy,
reader: reader,
writer: writer, // <-- plug a DataWriter into the store just as you would a Reader
autoSave: false // <-- false would delay executing create, update, destroy requests until specifically told to do so with some [save] buton.
});

//read the data from simple array
store.load();

Ext.data.DataProxy.addListener('exception', function(proxy, type, action, options, res) {
Ext.Msg.show({
title: 'ERROR',
msg: res.message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
});


I am not able figure out where would be the error.

Regards
Sach

börn
12 Mar 2012, 10:53 PM
No sorry, I meant that you should look into the store with your browsers console... You can get the store with its storeid and the storemanager. Even if the records are returned to your page it must not be that they are correctly put in the store. If you click in the grid do you see some slim selection?

sachintaware
12 Mar 2012, 11:04 PM
Sorry born,but how can I do that?
I see 4 tabs in the console Json,Response,Headers,Post

How can get the store by its Id???I have not done this anytime.
yes and I do get the slim selection,i.e the border for entire row can be seen and i can scroll through using arrow keys.

Thanks
Sach
www.optionsconsultancy.com

sachintaware
12 Mar 2012, 11:36 PM
@born
I did this to check if the store has the records.(Not sure if you suggested the same) and I get a "0",which means no record is in the store.



var count = store.getCount();
console.log(count);


Thanks
Sach

sachintaware
13 Mar 2012, 9:06 PM
hello born
still stuck on this
I have also created a new thread for this specific issue.

http://www.sencha.com/forum/showthread.php?187319-Grid-not-populated-with-records&goto=newpost

Thanks
Sach
www.optionsconsultancy.com

sachintaware
14 Mar 2012, 4:53 AM
Hi born
I think i got the problem [not the solution yet ;) ]

Now i have used a join to fetch the results and they are returned as follows.These are from 3 different tables and hence looks as a nested json



[{"id":71,"reqid":33,"statusTitle":"Pending"},{"id":45,"firstName":"Vikram","lastName":"","email":"bj.vikram@gmail.com"},{"id":33,"client":{"id":12,"clientName":"HireCraft"},"clientId":12,"reqTitle":"Java Developer"}]
[{"id":312,"reqid":53,"statusTitle":"CV-Sent"},{"id":4155,"firstName":"Aniruddha","lastName":"Nalgirkar","email":"ani_nalgirkar@yahoo.co.in"},{"id":53,"client":{"id":21,"clientName":"Giesecke & Devrient India Pvt. Ltd."},"clientId":21,"reqTitle":"Embedded Engineer"}]



Now when I fetch records from a single table,i.e only 2-3 columns in the grid,they are displayed in the grid.
But,this isn't.How can I convert this into a plain single json record without the internal nesting?

To add further,I learnt from http://www.mkyong.com/spring-mvc/spring-3-mvc-and-json-example/ that @ResponseBody handles the JSON conversion automatically using Jackson. So,how can I fix this problem??

Thanks
Sach

sachintaware
14 Mar 2012, 11:27 PM
Hello
After some study I learnt that the nested JSON issue can be resolved using the @JsonUnwrapped
annotation.
I tried to add it to my model pojo's



private int id;
private String firstName;
private String lastName;
private String email;

@JsonUnwrapped
private Set<CandidateStatus> candidateStats = new HashSet<CandidateStatus>(0);

@OneToMany //(mappedBy="candidate")
@Fetch(FetchMode.JOIN)
@JoinColumn(name="ResID",nullable=false,referencedColumnName="RID")
@JsonIgnore
public Set<CandidateStatus> getCandidateStats() {
return candidateStats;
}
public void setCandidateStats(Set<CandidateStatus> candidateStats) {
this.candidateStats = candidateStats;
}

and


public class CandidateStatus{

private int id;
private String statusTitle;
@JsonUnwrapped
private Candidates candidate;
private int reqid;

@JsonUnwrapped
private Requirements requirement;

@ManyToOne
@Fetch(FetchMode.JOIN)
@JoinColumn(name="ReqID",insertable=false,updatable=false)
@JsonIgnore
public Requirements getRequirement() {
return requirement;
}

This is done at property level as it does not support class level declaration.
But I am still getting the same nested json.Now,it works when,




Value is serialized as JSON Object
Serialization is done using BeanSerializer, not a custom serializer
No type information is added; if type information needs to be added, structure can not be altered regardless of inclusion strategy; so annotation is basically ignored.


As I am using Jackson it uses BeanSerializer(I suppose),so what is the mistake I am committing?

Thanks
Sach
www.optionsconsultancy.com

sprakash
26 Jul 2012, 11:05 PM
@OneToMany(fetch = FetchType.EAGER,orphanRemoval = true,mappedBy="questionOption")
@Fetch(FetchMode.SELECT)
private List<OptionProperty> optionProperties=new ArrayList<OptionProperty>(0);


public List<OptionProperty> getOptionProperties() {
return optionProperties;
}

--------------------------------------

@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "option_id", nullable = false, insertable=false,updatable=false)
private QuestionOption questionOption;






@JsonIgnore
public QuestionOption getQuestionOption() {
return questionOption;
}

This will prevent the Recursion. i.e : Expose it as a Unidirectional Relation to Jackson. Bidirectional relation will cause the exception

vayumahesh
19 Jun 2013, 7:55 AM
Sach,

Is your error resolved ? Can you please post your final project zip file. I am new to Spring MVC and Hibernate and your example will help.

Thanks

sachintaware
19 Jun 2013, 6:06 PM
Hi vayumesh,
I cannot post the entire project but help you with yours if you have specific issues.This issue is resolved and I have posted the needed answer.Enter a new question and you will get answers for sure!!
All the best