Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3987982
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:11:54+00:00 2026-05-20T06:11:54+00:00

I understand that it is not really how Roo was intended to be used,

  • 0

I understand that it is not really how Roo was intended to be used, but I was to knock up a quick demo with Roo to run within a console app.

I have created a basic app with the following Roo Script:

project --topLevelPackage com.xetius.maths
persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY
entity --class ~.domain.Equation --testAutomatically
field number --fieldName firstNum --type java.lang.Integer --notNull
field number --fieldName secondNum --type java.lang.Integer --notNull
field string --fieldName operator --notNull
field number --fieldName answer --type java.lang.Integer

Next I want to add a basic console by adding the following class

package com.xetius.maths;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MathMain {
    public static void main(String[] args) {
        ApplicationContext appContext = new ClassPathXmlApplicationContext("applicationContext.xml");
        System.out.println("Here");
    }
}

My plan was to pass in firstNum, operator and secondNum, add these to the DB, then calculate the answer, add that to the DB, then display the response. If the answer couldn’t be calculate (with divide by 0 for example) then roll the transaction back.

This should be quite simple, and Im guessing that it is, however, I can’t work out how to access the sessionFactory. Is this implicit in something else, or am I just doing something wrong?

Am I just not able to do this, or is there another way to do this. This is all for a demo to my bosses to show the advantages of Roo, but can’t seem to get my head around this bit

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T06:11:55+00:00Added an answer on May 20, 2026 at 6:11 am

    After context is loaded, it is very simply

    Equation eq = new Equation();
    eq.setFirstNum(2);
    eq.setSecondNum(2);
    // and so on
    eq.persist();
    

    If you need to delete wrong entry you need to use

    eq.remove();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a newcomer to Python but I understand that things should not be done
I understand that nested <form> tags are not allowed, but I would like to
Now I'm not really sure what the problem here is but it seems that
I understand that speeding up the PHP side of things is not really possible.
I understand that it is not possible to tell what the user is doing
Please understand that I am not trying to start a flame war. I am
I do understand that it's not possible to replace the beforeunload dialog with a
I understand that branching in CUDA is not recommended as it can adversely affect
I understand that shared memory on GPU does not persist across different kernels. However,
I understand that static method inheritance is not supported in C#. I have also

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.