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.