1 / 97

Java Persistence: Core Object

v110223. Java Persistence: Core ORM. 2. Goals. Be able to map a single class and properties to the database using class annotations and ORM descriptorsBe able to get and set properties using get/set API calls instead of SQL. v110223. Java Persistence: Core ORM. 3. Objectives. Entitiesclass annotat

elam
Download Presentation

Java Persistence: Core Object

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. v110223 Java Persistence: Core ORM 1 Java Persistence: Core Object/Relational Mapping

    2. v110223 Java Persistence: Core ORM 2 Goals Be able to map a single class and properties to the database using class annotations and ORM descriptors Be able to get and set properties using get/set API calls instead of SQL

    3. v110223 Java Persistence: Core ORM 3 Objectives Entities class annotations orm.xml descriptor Primary Key Generation Primary Keys simple composite Fine Tuning Objects Multi-table Mappings Secondary Tables Embedded Objects

    4. v110223 Java Persistence: Core ORM 4 Entities Plain Old Java Object (POJO) Classes Instantiated and used just like any other POJO Bike bike = new Bike(1); bike.setMake("trek"); bike.setModel("2200"); bike.setSize(26); Mapped to the database schema Interact with EntityManager to perform persistence operations em.persist(bike); Bike bike2 = em.find(Bike.class, 1); em.remove(bike2); Must have a no-arg constructor (spec says non-private; hibernate can work with private) be denoted as an Entity (either within class or descriptor) have at least 1 field/property labeled as Id

    5. v110223 Java Persistence: Core ORM 5 Annotated Entity Example: Bike.java

More Related