Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Groovy
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Ron McLeod
Jeanne Boyarsky
Sheriffs:
Paul Clapham
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
Groovy
Grails: save() works, update and delete() do not work
Kai Wähner
Ranch Hand
Posts: 76
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi there,
I have the following simple integration
test
:
public void testMitarbeiter() { // works def m1 = new Mitarbeiter(name: 'Kai') m1.save() // does not work def neu = Mitarbeiter.get(m1.id) neu.name = 'Hans' // neu.save() // does not work either // works def m2 = new Mitarbeiter(name: 'xxx') m2.save() // does not work def fromDB = Mitarbeiter.get(1) // 1 is the id of the saved instance in the database fromDB.delete() }
Mitarbeiter is also simple:
class Mitarbeiter { String name static constraints = { name(unique: true) } }
The test passed without any errors. Saving some instances works, but I cannot update or delete them.
What's wrong with this code or what else could be the problem? (btw: I use the current Netbeans with Grails support as
IDE
).
Best regards, Kai
My IT-blog about my experiences with:
Java / JEE, IT Conferences and IT Certifications
Gregg Bolinger
Ranch Hand
Posts: 15304
6
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Try calling save(flush:true) instead of just save()
Kai Wähner
Ranch Hand
Posts: 76
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Although I am aware of the "flush"-concept in JPA, I did not find anything about it in my grails book and tutorials. Works now. Thank you...
My IT-blog about my experiences with:
Java / JEE, IT Conferences and IT Certifications
and POOF! You're gone! But look, this tiny ad is still here:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
testing String as immutable
Objects as Map keys without Hashcode and equals.
Stupid doubt about Grails ORM
multiple synchronized block in class..
HashMap
More...