summaryrefslogtreecommitdiffstats
path: root/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/Account.java
diff options
context:
space:
mode:
authorSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
committerSven Eisenhauer <sven@sven-eisenhauer.net>2023-11-10 15:11:48 +0100
commit33613a85afc4b1481367fbe92a17ee59c240250b (patch)
tree670b842326116b376b505ec2263878912fca97e2 /Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/Account.java
downloadStudium-33613a85afc4b1481367fbe92a17ee59c240250b.tar.gz
Studium-33613a85afc4b1481367fbe92a17ee59c240250b.tar.bz2
add new repoHEADmaster
Diffstat (limited to 'Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/Account.java')
-rw-r--r--Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/Account.java1
1 files changed, 1 insertions, 0 deletions
diff --git a/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/Account.java b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/Account.java
new file mode 100644
index 0000000..1efa132
--- /dev/null
+++ b/Master/Reference Architectures and Patterns/EJB 3.0 Code/Gerald Examples/src/examples/entity/intro/Account.java
@@ -0,0 +1 @@
+package examples.entity.intro; import java.io.Serializable; import javax.persistence.AccessType; import javax.persistence.Entity; import javax.persistence.EntityListener; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.PostLoad; import javax.persistence.PostUpdate; import javax.persistence.PrePersist; import javax.persistence.PreUpdate; import javax.persistence.Version; /** * This demo entity represents a Bank Account. * <p> * The entity is not a remote object and can only be accessed locally by * clients. However, it is made serializable so that instances can be passed by * value to remote clients for local inspection. * <p> * Access to persistent state is by direct field access. */ @Entity(access = AccessType.FIELD) @EntityListener(MyListener.class) @NamedQuery(name="findThem", query="SELECT a FROM Account a") public class Account implements Serializable { /** The account number is the primary key for the persistent object */ @Id public int accountNumber; public String ownerName; public int balance; @Version public int version; /** * Entity beans must have a public no-arg constructor */ public Account() { // our own primary key generation, workaround for the // time being as Glassfish persistence does not support // auto-generation accountNumber = (int) System.nanoTime(); } public String toString() { return "Acc.# " + accountNumber + ", owner" + ownerName + ", balance: " + balance + " $"; } @PrePersist void prepersist() { System.out.println("pre persist!!"); } @PreUpdate void preupdate() { System.out.println("pre update!!"); } @PostUpdate void postupdate() { System.out.println("post update!!"); } @PostLoad void postload() { System.out.println("post load!!"); } } \ No newline at end of file