alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Groovy example source code file (CreateData.groovy)

This example Groovy source code file (CreateData.groovy) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Groovy tags/keywords

char, char, create, create, dain, groovy, increment, int, int, key, ok, primary, primary, table

The Groovy CreateData.groovy source code

println("Called with context: " + context)

db = context.lookup("/client/tools/DatabaseHome").create()

println("About to do queries on: " + db)

queries = [
        "CREATE TABLE account ( ssn CHAR(11) PRIMARY KEY, first_name CHAR(20), last_name CHAR(20), balance INT)",
        "CREATE TABLE entity ( id INT PRIMARY KEY AUTO INCREMENT, first_name CHAR(20), last_name CHAR(20) )"
]

for (sql in queries) {
    println("evaluating: " + sql)
    db.execute(sql)
}

println("creating entity bean")

context.lookup("/client/tests/entity/bmp/BasicBmpHome").create("Groovy Dain")

println("Done")

"OK"

Other Groovy examples (source code examples)

Here is a short list of links related to this Groovy CreateData.groovy source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.