-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Strange Exception when Persisting Set
PostPosted: Wed Sep 29, 2004 5:38 pm 
Newbie

Joined: Wed Sep 29, 2004 5:17 pm
Posts: 2
Location: New York
The mapping file is in the applicationContext (since the same file is used by other objects which are working correctly in hibernate). The problem is in persisting the set of EmailSent objects, as no error occurs when the set is empty.

Any suggestions?

Hibernate version:

2.1.13

Mapping documents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping auto-import="true">

<class name="net.iagr.campaign.mail.data.EmailTemplate" table="EmailTemplate">
<id name="emailTemplateID" column="emailtemplateid" type="int" unsaved-value="0">
<generator class="sequence">
<param name="sequence">emailtemplate_key</param>
</generator>
</id>
<property name="templateKey" column="emailtemplatekey" type="string"/>
<property name="name" column="emailtemplatename" type="string" not-null="true"/>
<property name="description" column="description" type="string"/>
<property name="subject" column="subject" type="string" not-null="true"/>
<property name="htmlContent" column="bodytexthtml" type="org.springframework.orm.hibernate.support.ClobStringType" not-null="true"/>
<property name="textContent" column="bodytextplain" type="org.springframework.orm.hibernate.support.ClobStringType" not-null="true"/>
<property name="fromName" column="fromname" type="string" not-null="true"/>
<property name="fromAddress" column="fromaddress" type="string" not-null="true"/>
<property name="resolver" column="resolver" type="string" not-null="true"/>
<property name="creationDate" column="creationdate" type="date" insert="false" update="false"/>
<property name="updateDate" column="updatedate" type="date" insert="false" update="false"/>
<property name="priority" column="priority" type="int" update="false"/>
<set name="schedules" table="EmailSchedules" cascade="all-delete-orphan" lazy="true" order-by="creationdate desc">
<key column="emailTemplateID"/>
<one-to-many class="net.iagr.campaign.mail.data.EmailSchedule"/>
</set>
</class>

<class name="net.iagr.campaign.mail.data.EmailSchedule" table="EmailSchedules">
<id name="emailScheduleID" column="emailScheduleID" type="int" unsaved-value="0">
<generator class="sequence">
<param name="sequence">emailschedule_key</param>
</generator>
</id>
<property name="emailTemplateID" column="emailTemplateID" type="int" not-null="true"/>
<property name="startTime" column="startTime" type="timestamp" not-null="true"/>
<property name="endTime" column="endTime" type="timestamp" not-null="true"/>
<property name="frequency" column="frequency" type="long" not-null="true"/>
<property name="scheduleName" column="scheduleName" type="string" not-null="true"/>
<property name="emailGroupName" column="emailGroupName" type="string" not-null="true"/>
<property name="creationDate" column="creationdate" type="date" insert="false" update="false"/>
<one-to-one name="batch"
class="net.iagr.campaign.mail.data.EmailBatch"
constrained="false"
property-ref="emailScheduleID"/>
</class>

<class name="net.iagr.campaign.mail.data.EmailBatch" table="EmailBatch">
<id name="emailBatchID" column="emailBatchID" type="int" unsaved-value="0">
<generator class="sequence">
<param name="sequence">emailbatch_key</param>
</generator>
</id>
<property name="launchTime" column="launchTime" type="timestamp" not-null="true"/>
<property name="status" column="emailBatchStatusID" type="int" not-null="true"/>
<property name="batchNo" column="emailBatchNumber" type="int" not-null="true"/>
<property name="emailScheduleID" column="emailScheduleID" type="int" not-null="true"/>
<set name="emailSents" inverse="true" cascade="all">
<key column="emailBatchID" />
<one-to-many class="net.iagr.campaign.mail.data.EmailSent" />
</set>

</class>

<class name="net.iagr.campaign.mail.data.EmailSent" table="EmailSent">
<id name="emailSentID" column="emailSentID" type="int" unsaved-value="0">
<generator class="sequence"><param name="sequence">emailsent_key</param></generator>
</id>
<property name="emailAddress" column="emailAddress" type="string" not-null="true"/>
<property name="rtvMemberID" column="rtvMemberID" type="int"/>
<property name="deleteAfter" column="deleteAfter" type="date" not-null="true" />
<property name="creationDate" column="creationDate" type="date" not-null="true" />
<property name="viewed" column="viewed" type="string" />
<property name="updateDate" column="updateDate" type="date" not-null="true" />
<many-to-one name="emailBatchID" class="net.iagr.campaign.mail.data.EmailBatch" column="emailBatchID"/>
</class>

</hibernate-mapping>

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

//constrained by the current DB schema, we're
//handling saving of batches ourselves
EmailBatch batch = schedule.getBatch();
//get emails in group
Set emailsents = new HashSet();

EmailGroup group =(EmailGroup)(Class.forName(schedule.getEmailGroupName())).newInstance();
logger.warning("Group Loaded: "+ group.getDescription());
Calendar c = Calendar.getInstance();
Date today = c.getTime(); c.add(Calendar.YEAR,50);
Date future = c.getTime();
while(group.hasNext()) {
EmailUser user = group.getNextUser();

logger.warning("User Loaded: "+ user.getEmailAddress()+ " on " + today + " until " + future);
EmailSent sentto = new EmailSent();
sentto.setRtvMemberID(user.getRTVMemberID());
sentto.setEmailAddress(user.getEmailAddress());
sentto.setViewed("N");
sentto.setCreationDate(today);
sentto.setUpdateDate(today);
sentto.setDeleteAfter(future);
sentto.setEmailBatch(batch);
logger.warning("User written: "+ sentto.toString());
emailsents.add(sentto);
}

batch.setEmailSents(emailsents);
batch.setLaunchTime(schedule.getStartTime());
batch.setEmailScheduleID(schedule.getEmailScheduleID());
getMailDAO().saveEmailBatch(batch);

Full stack trace of any exception that occurs:
org.springframework.orm.hibernate.HibernateSystemException: No persister
for: java.lang.Integer; nested exception is net.sf.hibernate.MappingException:
No persister for: java.lang.Integer
net.sf.hibernate.MappingException: No persister for: java.lang.Integer
at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:344)
at net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionImpl.java:2681)
at net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.java:2688)
at net.sf.hibernate.impl.SessionImpl.isUnsaved(SessionImpl.java:1083)
at net.sf.hibernate.impl.SessionImpl.nullifyTransientReferences(SessionImpl.java:1029)
at net.sf.hibernate.impl.SessionImpl.nullifyTransientReferences(SessionImpl.java:1015)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:920)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:850)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:772)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:731)
at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1380)
at org.springframework.orm.hibernate.HibernateTemplate$10.doInHibernate(HibernateTemplate.java:259)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:150)
at org.springframework.orm.hibernate.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:257)
at net.iagr.campaign.mail.MailDAOImpl.saveEmailSent(MailDAOImpl.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.springframework.aop.framework.AopProxyUtils.invokeJoinpointUsingReflection(AopProxyUtils.java:59)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:149)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:118)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:191)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:148)
at $Proxy4.saveEmailSent(Unknown Source)
at net.iagr.campaign.mail.web.ProcessBatchAction.doExecute(ProcessBatchAction.java:84)
at net.iagr.site.BaseAction.execute(BaseAction.java:33)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:165)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:96)
at org.springframework.orm.hibernate.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:117)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:73)
at com.caucho.server.http.FilterChainFilter.doFilter(FilterChainFilter.java:88)
at com.caucho.server.http.Invocation.service(Invocation.java:315)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:346)
at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:274)
at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:534)

Name and version of the database you are using:

Oracle 9i

_________________
< w o r l d w i d e w e b e r >


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.