Skip to content

Instantly share code, notes, and snippets.

View cosbor11's full-sized avatar
🤓
always coding

Chris Osborn cosbor11

🤓
always coding
View GitHub Profile
@cosbor11
cosbor11 / Main.java
Created March 1, 2017 03:28
Onyx Web Service Database main application
public static void main(String[] args) throws Exception
{
WebDatabaseServer server1 = new WebDatabaseServer();
server1.setWebServicePort(8080);
server1.setPort(8081);
String pathToOnyxDB = System.getProperty("user.home")
+ File.separatorChar + ".onyxdb"
+ File.separatorChar + "sandbox"
+ File.separatorChar +"remote-db.oxd";
@cosbor11
cosbor11 / pom.xml
Created March 1, 2017 03:24
Onyx Remote Database dependency within maven pom
<groupId>com.onyxdevtools.samples</groupId>
<artifactId>onyx-database-server</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.onyxdevtools</groupId>
<artifactId>onyx-remote-database</artifactId>
<version>${onyx-database.version}</version>
@cosbor11
cosbor11 / pom.xml
Created August 17, 2016 21:22
maven shade plugin
<!-- Maven Shade Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
@cosbor11
cosbor11 / LazyQueryExample.java
Created July 14, 2016 18:39
Get and print out all of the entites in the LazyQueryCollection
for (int i = 0; i < allPlayers.size(); i++)
{
final Player player = allPlayers.get(i); // retreives the Player when invoked
System.out.println(player.getFirstName() + " " + player.getLastName());
}
@cosbor11
cosbor11 / LazyQueryExample.java
Created July 14, 2016 18:38
Invoke manager#executeLazyQuery
final List<Player> allPlayers = manager.executeLazyQuery(query); //returns LazyQueryCollection
@cosbor11
cosbor11 / LazyQueryExample.java
Created July 14, 2016 18:34
create a simple query to include all records
final Query query = new Query(Player.class);
@cosbor11
cosbor11 / SortingAndPagingExample.java
Created July 14, 2016 15:22
Print the second page results
System.out.println("\nPage 2:");
for (final Player player : page2)
{
System.out.println(player.getLastName() + ", " + player.getFirstName());
}
@cosbor11
cosbor11 / SortingAndPagingExample.java
Created July 14, 2016 15:20
Query for the second page (rows 10-19, records 11-20)
final List<Player> page2 = manager.executeQuery(query);
@cosbor11
cosbor11 / SortingAndPagingExample.java
Created July 14, 2016 15:19
Set the firstRow and maxResults to retrieve the second page
query.setFirstRow(query.getFirstRow() + query.getMaxResults());
@cosbor11
cosbor11 / SortingAndPagingExample.java
Created July 14, 2016 15:13
Print the first page results
System.out.println("\nPage 1:");
for (final Player player : page1)
{
System.out.println(player.getLastName() + ", " + player.getFirstName());
}