Created
July 7, 2016 14:15
-
-
Save cosbor11/f83ddd129c645101f60cd37bbd72d518 to your computer and use it in GitHub Desktop.
Retrive an Account using a long value and verify the generator is no longer used.
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
// Fetch an account. Notice that the id is now a long rather than an integer. | |
Account account = (Account)persistenceManager.findById(Account.class, 1l); | |
assert account.getAccountId() == 1l; | |
// This example creates a new account and attempts to save it without an identifier. | |
Account account2 = new Account(); | |
persistenceManager.saveEntity(account2); | |
// The account ID was not auto incremented. | |
// This is because we removed the generator from the @Identifier annotation. | |
assert account2.getAccountId() == 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment