6 Replies - 2226 Views - Last Post: 27 June 2012 - 06:31 PM Rate Topic: -----

#1 armyson  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 25-November 11

Using Java in Grails

Posted 21 June 2012 - 03:29 PM

I was recently using java to make a form for people to enter in information and it would update the database accordingly. I am now at the part where I have to access the database and I was told to use Grails. I have been reading tutorials about it but I am still confused. How do I use grails to get information about my server to java, or get my java code into grails to be executed. Thanks.
Is This A Good Question/Topic? 0
  • +

Replies To: Using Java in Grails

#2 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8327
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Using Java in Grails

Posted 21 June 2012 - 03:52 PM

Can you post a link to which Grails you are talking about ?
Was This Post Helpful? 0
  • +
  • -

#3 Ghlavac  Icon User is offline

  • D.I.C Addict

Reputation: 84
  • View blog
  • Posts: 519
  • Joined: 14-January 09

Re: Using Java in Grails

Posted 21 June 2012 - 05:29 PM

Seeing as there's only one related to java probably this one.

http://grails.org/

Also armyson have you considered using the grail community forums to ask these questions for the more experienced grails related help?

This post has been edited by Ghlavac: 21 June 2012 - 05:32 PM

Was This Post Helpful? 0
  • +
  • -

#4 armyson  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 25-November 11

Re: Using Java in Grails

Posted 22 June 2012 - 07:12 AM

Yes it is the ones at grails.org
Was This Post Helpful? 0
  • +
  • -

#5 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10446
  • View blog
  • Posts: 38,686
  • Joined: 27-December 08

Re: Using Java in Grails

Posted 22 June 2012 - 08:26 AM

You don't need Grails to connect to your database server, though you can certainly use Grails. If you want to stick with vanilla Java, you can use the JDBC API:

www.dreamincode.net/forums/topic/32360-using-mysql-with-java/
http://www.dreaminco...bc-odbc-bridge/
http://www.dreaminco...g-with-an-odbc/
Was This Post Helpful? 0
  • +
  • -

#6 armyson  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 25-November 11

Re: Using Java in Grails

Posted 22 June 2012 - 08:44 AM

See that's what I wanted to do. The person I am doing this for however wants me to do it in Grails
Was This Post Helpful? 0
  • +
  • -

#7 heidiGrails  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 1
  • Joined: 27-June 12

Re: Using Java in Grails

Posted 27 June 2012 - 06:31 PM

View Postarmyson, on 22 June 2012 - 08:44 AM, said:

See that's what I wanted to do. The person I am doing this for however wants me to do it in Grails


Grails provides a lot of "convention over configuration" features so you can build applications quickly. One of these features is building up all the basic create, read, update and delete (CRUD) like methods you need to interact with your objects in the database. In the Grails documentation this is under the heading of Grails object relational management (GORM) (http://grails.org/do...guide/GORM.html and http://grails.org/do...ingStarted.html).

There are also some very good tutorials on getting started with grails over at IBM developerWorks by Scott Davis called Mastering Grails (http://www.ibm.com/d...1158/index.html). Grails in Action from Manning is a great book to help you get started.

What Grails will also provide you with in addition to the object relational mapping is a quick way to bring up views and controllers for a web application. I used Spring prior to switching to Grails and found all the configuration and boilerplate classes for the views and controllers to be tedious, not to mention building custom tag libraries for the views to use. Grails gives you an easy way to create the views and basic CRUD actions in the controllers by using what they call scaffolding (http://grails.org/do...heWebLayer.html). The developerWorks link above explains how to automatically create views and controllers in the Grails application under the subheading "Building the controller and views".

You can use JDBC from Java to access the database, but you would not be utilizing one of the standard features of Grails that allows you to not have to generate all the JDBC code in order to interact with your domain objects. If you are being asked to build the application in Grails, I would take advantage of the GORM features.
Was This Post Helpful? 2
  • +
  • -

Page 1 of 1