Created
July 14, 2017 05:58
-
-
Save calvincodes/14c0c6939b1734d70116116a0f4c426b to your computer and use it in GitHub Desktop.
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
private void persistTransientBeanWithId() { | |
// Get a non managed (Transient) product object - Having id set | |
Product transientProductWithId = ProductMother.getBasicProduct(); | |
dao.update(transientProductWithId, "New Brand Name"); | |
} | |
private void persistTransientBeanWithoutId() { | |
// Get a non managed (Transient) product object - And reset ID to null | |
// This will result in creation of product | |
Product transientProductWithoutId = ProductMother.getBasicProduct(); | |
transientProductWithoutId.setId(null); | |
dao.update(transientProductWithoutId, "New Brand Name"); | |
} | |
private void persistPersistentBean() { | |
// Will internally get a managed (Persistent) product object | |
// This will have NO AFFECT on the object at all | |
dao.update(1l, "New Brand Name"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment