-->
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.  [ 2 posts ] 
Author Message
 Post subject: Cannot update rows in database
PostPosted: Wed Apr 20, 2005 6:12 am 
Regular
Regular

Joined: Fri Feb 25, 2005 3:02 am
Posts: 71
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hi, I'm trying to update a specific row in my table, but I got the following error from Jonas console:
Can anyone please help me.
Thanks in advance

[b]Hibernate version: 3.0 [/b]

[b]Mapping documents:[/b]

[b]Code between sessionFactory.openSession() and session.close():
session = HibernateUtil.currentSession();
tx = session.beginTransaction();

String sql = "FROM GlopUserType u WHERE u.jobTitle = :jobTitle ";
Query query = session.createQuery(sql);
query.setParameter("jobTitle", new String("program"));
GlopUserType usrType = (GlopUserType)query.list().get(0);
usrType.setJobTitle(titleName);
session.saveOrUpdate(usrType);
[/b]

[b]Full stack trace of any exception that occurs:

Jonas Console Error:

2005-04-20 14:01:22,229 : SchemaUpdate.execute : schema update complete
2005-04-20 14:01:22,323 : ReadOnlyCache.lock : Application attempted to edit read only item: org.objectweb.alarm.beans.GlopUserType#1
2005-04-20 14:01:22,323 : ReadOnlyCache.release : Application attempted to edit read only item: org.objectweb.alarm.beans.GlopUserType
java.lang.UnsupportedOperationException: Can't write to a readonly object
at org.hibernate.cache.ReadOnlyCache.lock(ReadOnlyCache.java:43)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:69)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:137)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:675)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:293)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at org.objectweb.alarm.beans.SessionTataBean.updateUserType(Unknown Source)
at org.objectweb.alarm.beans.JOnASSessionTata437579213Remote.updateUserType(JOnASSessionTata437579213Remote.java:216)
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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at org.objectweb.carol.rmi.jrmp.server.JUnicastServerRef.runDispatch(JUnicastServerRef.java:160)
at org.objectweb.carol.rmi.jrmp.server.JUnicastServerRef.dispatch(JUnicastServerRef.java:145)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:534)
[/b]

[b]Name and version of the database you are using: Postgresql 8.0 [/b]

[b]The generated SQL (show_sql=true):[/b]

[b]Debug level Hibernate log excerpt:[/b]


Top
 Profile  
 
 Post subject: Cannot update rows in database
PostPosted: Wed Apr 20, 2005 6:41 am 
Regular
Regular

Joined: Fri Feb 25, 2005 3:02 am
Posts: 71
Hi,

I've found the cause of my error. It's only because I've put the following tag in my POJO:

@hibernate.cache usage = "read-only".

I change the readonly to 'transactional' and it works


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.