This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.sql.Sql; | |
import java.sql.Connection | |
import java.sql.DriverManager; | |
import java.sql.SQLException; | |
import java.util.Properties; | |
class GroovyInsertPersonOutputIdParameter { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.sql.Sql; | |
import java.sql.Connection | |
import java.sql.DriverManager; | |
import java.sql.SQLException; | |
import java.util.Properties; | |
class GroovySQLTesting { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select * into [new_database]..tbl_MY_TABLE | |
from [old_database]..tbl_MY_TABLE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mattdalesio.morphiaTesting; | |
import java.util.ArrayList; | |
import java.util.List; | |
import org.bson.types.ObjectId; | |
import org.mongodb.morphia.annotations.*; | |
@Entity("employees") | |
@Indexes( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mattdalesio.morphiaTesting; | |
import java.util.List; | |
import org.mongodb.morphia.Datastore; | |
import org.mongodb.morphia.Morphia; | |
import org.mongodb.morphia.query.Query; | |
import org.mongodb.morphia.query.UpdateOperations; | |
import org.mongodb.morphia.query.UpdateResults; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hibernate; | |
public class User { | |
private int id; | |
private String name; | |
private int total; | |
private int goal; | |
public int getId() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hibernate; | |
import org.hibernate.Session; | |
public class ProteinTracker { | |
public static void main(String[] args) { | |
Session session = hibernateUtils.getSessionFactory().openSession(); | |
session.beginTransaction(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hibernate; | |
import org.hibernate.SessionFactory; | |
import org.hibernate.boot.registry.StandardServiceRegistryBuilder; | |
import org.hibernate.cfg.Configuration; | |
import org.hibernate.service.ServiceRegistry; | |
public class hibernateUtils { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
comment = {"author": "fred", | |
"date": new Date(), | |
"text": "Best Movie Ever"} | |
db.posts.update({"_id": ObjectId("554a2380df506c53b1a78647")}, {$push:{"comments": comment}}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//find posts with any tags | |
db.posts.find({tags:{$exists:true}}).pretty() | |
//find posts matching a regular expression | |
db.posts.find({author:/^rog*/i}).pretty() | |
//count posts by author | |
db.posts.find({author: 'roger'}).count() |