This file contains hidden or 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
| java -jar target/onyx-database-server-1.0.1.jar |
This file contains hidden or 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
| <groupId>com.onyxdevtools.samples</groupId> | |
| <artifactId>onyx-database-client</artifactId> | |
| <packaging>jar</packaging> | |
| <dependencies> | |
| <dependency> | |
| <groupId>com.onyxdevtools</groupId> | |
| <artifactId>onyx-remote-driver</artifactId> | |
| <version>${onyx-database.version}</version> | |
| </dependency> |
This file contains hidden or 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
| PersistenceManagerFactory factory = new RemotePersistenceManagerFactory(); | |
| factory.setCredentials("onyx-remote", "SavingDataIsFun!"); | |
| factory.setDatabaseLocation("onx://localhost:8080"); | |
| factory.initialize(); | |
| PersistenceManager manager = factory.getPersistenceManager(); |
This file contains hidden or 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
| @Entity | |
| public class Sailboat | |
| { | |
| @Identifier | |
| @Attribute | |
| protected String registrationCode; | |
| @Attribute | |
| protected String name; |
This file contains hidden or 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
| @Entity | |
| public class Skipper | |
| { | |
| @Identifier(generator = IdentifierGenerator.SEQUENCE) | |
| @Attribute | |
| protected long id; | |
| @Attribute | |
| protected String firstName; |
This file contains hidden or 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
| // Create a new sailboat named Wind Passer and Registration(Primary Key) NCC1701 | |
| Sailboat sailboat = new Sailboat(); | |
| sailboat.setRegistrationCode("NCC1701"); | |
| sailboat.setName("Wind Passer"); | |
| // Create a new Skipper named Martha McFly | |
| Skipper sailboatSkipper = new Skipper(); | |
| sailboatSkipper.setFirstName("Martha"); | |
| sailboatSkipper.setLastName("McFly"); |
This file contains hidden or 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
| manager.saveEntity(sailboat); | |
| System.out.println("Created a new Sailboat " + sailboatSkipper.getSailboat().getName() + " with Skipper " + sailboatSkipper.getFirstName()); |
This file contains hidden or 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
| Sailboat newlyCreatedSailboat = manager.findWithId("NCC1701"); | |
| System.out.println("Sailboat " + newlyCreatedSailboat.getName() + " was created with skipper" + newlyCreatedSailboat.getSkipper().getFirstName()); |
This file contains hidden or 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
| @Entity | |
| public class Sailboat | |
| { | |
| @Identifier | |
| @Attribute | |
| protected String registrationCode; | |
| @Attribute | |
| protected String name; |
This file contains hidden or 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
| @Entity | |
| public class CrewMember | |
| { | |
| @Identifier(generator = IdentifierGenerator.SEQUENCE) | |
| @Attribute | |
| public long id; | |
| @Attribute | |
| public String firstName; |