Hi if I have the following codes in a controller, does the person object get destroy after the web page is served?
Person p = new Person();
for (int u =0 ...)
{
p = new Person();
p.save();
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, the object instances are all destroyed after the request is served. In your example, only the data in the database will exist across requests.
Read more about Grails controllers in the official docs. See the section Controllers and Scopes about the different scopes where you can store variables across requests.