-->
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.  [ 3 posts ] 
Author Message
 Post subject: SQLException: Connection is read-only
PostPosted: Sat Feb 26, 2005 9:35 am 
Newbie

Joined: Mon Jan 17, 2005 7:32 am
Posts: 13
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp



Hi people,


I've been encountering these past few days and I can't seem to solved this problem on my self. I hope you could help me on this. Here's the scenario:
1) retrieve a User object and this user has a property of list of UserActivity objects
2) from this list of UserActivity objects, the web user selects a particular object UserActivity
3) the system retrieve again this UserActivity object from the database
4) iterate the list of UserActivity object's property which is Activity (one-to-many) and set one of the Activity object property's object.
3) return this UserActivity object from the frontend Action class set this to local variable in Action class then boom! I get this weird exception:
Error: org.springframework.jdbc.UncategorizedSQLException: (HibernateTemplate):
encountered SQLException [Connection is read-only. Queries leading to data modi
fication are not allowed]; nested exception is java.sql.SQLException: Connection
is read-only. Queries leading to data modification are not allowed
org.springframework.jdbc.UncategorizedSQLException: (HibernateTemplate): encount
ered SQLException [Connection is read-only. Queries leading to data modification
are not allowed]; nested exception is java.sql.SQLException: Connection is read
-only. Queries leading to data modification are not allowed
java.sql.SQLException: Connection is read-only. Queries leading to data modifica
tion are not allowed
at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedSta
tement.java:719)


This is the part in the Action class where the exception occurs:
UserActivityVO userActivity = userActivityWorker.getUserActivity(user, new Long(userActivityId));

This is the mapping of Activity object property that's causing the error:
/**
* @hibernate.many-to-one cascade="save-update" column="fk_leave_request_id"
*/
public LeaveRequestVO getAssociatedLeaveRequest() {
return associatedLeaveRequest;
}


This is the part in the backend the sets the Activity object property:
..
List leaveRequest = leaveRequestDao.getLeaveRequests(user.getUserId());
...

while (iterator.hasNext())
{
activity = (ActivityVO)iterator.next();

LeaveRequestVO leaveReqVO = (LeaveRequestVO) leaveRequest.get(0);
log.debug("\n leaveReqVO.getLeaveRequestId() = "+ leaveReqVO.getLeaveRequestId());
activity.setAssociatedLeaveRequest(leaveReqVO); // if I comment this I will not encounter this error

....
}



I don't whats happening on my system but I set associated leave request I get this exception. I replace leave request statement with another activity's property let's say a plain String object Activity property I still get weird error. Please help me.


I'm using the project from equinox.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 28, 2005 6:20 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
As it looks you have read-only connection. But when you make activity dirty, Hibernate try's to update it.
Detach object before making it dirty.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 01, 2005 4:09 am 
Newbie

Joined: Mon Jan 17, 2005 7:32 am
Posts: 13
alesj wrote:
As it looks you have read-only connection. But when you make activity dirty, Hibernate try's to update it.
Detach object before making it dirty.



I see. But how did I get a read-only connection in the backend only and not on the frontend side? You see, if were able to modify or process the object on the backend side before and send the full processed object to the frontend then I will be able to save some time..... I'm using Tomcat (jakarta-tomcat-5.0.25) server and MySQL 4.1 on my database...


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

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.