SlideShare uma empresa Scribd logo
1 de 17
Oracle TopLink & JPA ,[object Object],[object Object],[object Object]
오늘 이야기할 사항 ,[object Object],[object Object]
￵ TopLink 가 하는 일 ,[object Object]
TopLink Key Features ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
TopLink 구성요소 Standalone J2SE  application Environment TopLink Workbench (GUI Tool)
TopLink Application Packaging ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],You can use those through  TopLink API! sessions.xml project.xml
 
TopLink 의 기능 (1) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Client JAXB XML TopLink Layer
TopLink 의 기능 (1) <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> <toplink-sessions version=&quot;10g Release 3 (10.1.3.3.0)&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;> <session xsi:type=&quot;database-session&quot;> <name>examples.ox.model</name> <event-listener-classes/> <primary-project xsi:type=&quot;xml&quot;>/home/all4you/tmp/xmlmapping/classes/CustomerProject.xml</primary-project> <login xsi:type=&quot;xml-login&quot;/> </session> </toplink-sessions>~  <opm:class-mapping-descriptor xsi:type=&quot;toplink:xml-class-mapping-descriptor&quot;> <opm:class>examples.ox.model.Address</opm:class> <opm:alias>Address</opm:alias> <opm:events xsi:type=&quot;toplink:event-policy&quot;/> <opm:querying xsi:type=&quot;toplink:query-policy&quot;/> <opm:attribute-mappings> ............................................ <opm:attribute-mapping xsi:type=&quot;toplink:xml-direct-mapping&quot;> <opm:attribute-name>province</opm:attribute-name> <opm:field name=&quot;state/text()&quot; xsi:type=&quot;toplink:node&quot;/> <opm:converter xsi:type=&quot;toplink:object-type-converter&quot;> <toplink:type-mappings> <toplink:type-mapping> <toplink:object-value xsi:type=&quot;xsd:string&quot;>Alaska</toplink:object-value> <toplink:data-value xsi:type=&quot;xsd:string&quot;>AK</toplink:data-value> </toplink:type-mapping> <toplink:type-mapping> <toplink:object-value xsi:type=&quot;xsd:string&quot;>Arkansas</toplink:object-value> <toplink:data-value xsi:type=&quot;xsd:string&quot;>AR</toplink:data-value> </toplink:type-mapping> </toplink:type-mappings> </opm:converter> </opm:attribute-mapping> </opm:attribute-mappings> Project myProject = session.getProject(); XMLContext  context = new XMLContext(myProject); XMLMarshaller marshaller = context.createMarshaller(); marshaller.marshal(myObject, outputStream); marshaller.setFormattedOutput(true); XMLUnmarshaller unmarshaller = context.createUnmarshaller(); Employee emp =  (Employee)unmarshaller.unmarshal(new File(&quot;employee.xml&quot;)); XMLValidator validator = context.createValidator(); boolean isValid = validator.validate(emp);
TopLink 의 기능 (2) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
TopLink 의 기능 (2) <session xsi:type=&quot;database-session&quot;> <name>advancedtutorial</name> <event-listener-classes/> <primary-project xsi:type=&quot;xml&quot;>/home/all4you/tmp/adtutorial/src/META-INF/project.xml</primary-project> <login xsi:type=&quot;database-login&quot;> <platform-class>oracle.toplink.platform.database.oracle.Oracle10Platform</platform-class> <user-name>scott</user-name> <password>3E20F8982C53F4ABA825E30206EC8ADE</password> <sequencing> <default-sequence xsi:type=&quot;table-sequence&quot;> <name>Default</name> </default-sequence> </sequencing> <driver-class>oracle.jdbc.driver.OracleDriver</driver-class> <connection-url>jdbc:oracle:thin:@192.168.1.43:1532:ora10g</connection-url> </login> </session> </toplink-sessions> <opm:class-mapping-descriptors> <opm:class-mapping-descriptor xsi:type=&quot;toplink:relational-class-mapping-descriptor&quot;> <opm:class>example.model.PhoneNumber</opm:class> <opm:alias>PhoneNumber</opm:alias> <opm:primary-key> <opm:field table=&quot;PHONE&quot; name=&quot;EMP_ID&quot; xsi:type=&quot;opm:column&quot;/> <opm:field table=&quot;PHONE&quot; name=&quot;TYPE&quot; xsi:type=&quot;opm:column&quot;/> </opm:primary-key> UnitOfWork uow = session.acquireUnitOfWork(); try { Employee employee = createEmployee(first, last, salary); Address address = createAddress(city, street); employee.setAddress(address); uow.registerNewObject(employee); uow.commit(); } finally { uow.release(); }
TopLink 의 기능 (3) ,[object Object],[object Object],[object Object],[object Object],[object Object]
TopLink Essentials - JPA ,[object Object],[object Object],EJB 3.0 TopLink Essentials glassfish JEUS
How to Use JPA ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
How to Use JPA @Entity @NamedQuery(name=&quot;findAllProducts&quot;, query=&quot;SELECT p FROM Product p&quot;) public class Product implements  Serializable  { @Id private String productId; private double price; private String description; public Product() { } public Product(String productId, double price, String description){ this.productId = productId; this.price = price; this.description = description; } public String getProductId() { return productId; } public void setProductId(String id) { this.productId = id; } <persistence version=&quot;1.0&quot; xmlns=&quot;http://java.sun.com/xml/ns/persistence&quot;> <persistence-unit name=&quot;hellojpa&quot; transaction-type=&quot;JTA&quot;> <jta-data-source>datasource1</jta-data-source> <!--<jta-data-source>jdbc/sample</jta-data-source>--> <properties/> </persistence-unit> </persistence> @PersistenceContext private EntityManager em; ..... public Product createProduct(String productId, double price, String desc){ Product product = new Product(productId, price, desc); em.persist(product); return product; } public Product getProduct(String productId){ return (Product) em.find(Product.class, productId); }
XML Mapping Relational Mapping EIS Mapping Oracle TopLink TopLink Essentials glassfish jeus-toplink-essentials.jar JEUS 6
 

Mais conteúdo relacionado

Mais procurados

jpa-hibernate-presentation
jpa-hibernate-presentationjpa-hibernate-presentation
jpa-hibernate-presentation
John Slick
 
Patni Hibernate
Patni   HibernatePatni   Hibernate
Patni Hibernate
patinijava
 
IBM Solutions '99 XML and Java: Lessons Learned
IBM Solutions '99 XML and Java: Lessons LearnedIBM Solutions '99 XML and Java: Lessons Learned
IBM Solutions '99 XML and Java: Lessons Learned
Ted Leung
 

Mais procurados (20)

Hibernate working with criteria- Basic Introduction
Hibernate working with criteria- Basic IntroductionHibernate working with criteria- Basic Introduction
Hibernate working with criteria- Basic Introduction
 
Introduction to Hibernate Framework
Introduction to Hibernate FrameworkIntroduction to Hibernate Framework
Introduction to Hibernate Framework
 
Hibernate using jpa
Hibernate using jpaHibernate using jpa
Hibernate using jpa
 
jpa-hibernate-presentation
jpa-hibernate-presentationjpa-hibernate-presentation
jpa-hibernate-presentation
 
REST dojo Comet
REST dojo CometREST dojo Comet
REST dojo Comet
 
Developing Transactional JEE Apps With Spring
Developing Transactional JEE Apps With SpringDeveloping Transactional JEE Apps With Spring
Developing Transactional JEE Apps With Spring
 
Hibernate
HibernateHibernate
Hibernate
 
JSP Standard Tag Library
JSP Standard Tag LibraryJSP Standard Tag Library
JSP Standard Tag Library
 
Boston Computing Review - Java Server Pages
Boston Computing Review - Java Server PagesBoston Computing Review - Java Server Pages
Boston Computing Review - Java Server Pages
 
Hibernate An Introduction
Hibernate An IntroductionHibernate An Introduction
Hibernate An Introduction
 
Patni Hibernate
Patni   HibernatePatni   Hibernate
Patni Hibernate
 
Spring (1)
Spring (1)Spring (1)
Spring (1)
 
GraphQL & Relay - 串起前後端世界的橋樑
GraphQL & Relay - 串起前後端世界的橋樑GraphQL & Relay - 串起前後端世界的橋樑
GraphQL & Relay - 串起前後端世界的橋樑
 
Hibernate in Action
Hibernate in ActionHibernate in Action
Hibernate in Action
 
IBM Solutions '99 XML and Java: Lessons Learned
IBM Solutions '99 XML and Java: Lessons LearnedIBM Solutions '99 XML and Java: Lessons Learned
IBM Solutions '99 XML and Java: Lessons Learned
 
Jpa
JpaJpa
Jpa
 
Hibernate ppt
Hibernate pptHibernate ppt
Hibernate ppt
 
Hibernate
HibernateHibernate
Hibernate
 
Advance java session 14
Advance java session 14Advance java session 14
Advance java session 14
 
java ee 6 Petcatalog
java ee 6 Petcatalogjava ee 6 Petcatalog
java ee 6 Petcatalog
 

Destaque

áReas funcionales de la empresa
áReas funcionales de la empresaáReas funcionales de la empresa
áReas funcionales de la empresa
Galaxy120686
 
Control administrativo
Control administrativoControl administrativo
Control administrativo
DianaAf
 
La empresa y sus areas funcionales presentacion para defensa
La empresa y sus areas funcionales presentacion para defensaLa empresa y sus areas funcionales presentacion para defensa
La empresa y sus areas funcionales presentacion para defensa
Zalimanunezc
 
Mapa conceptual de administracion
Mapa conceptual de administracionMapa conceptual de administracion
Mapa conceptual de administracion
juan daniel
 
Mapa conceptual de administracion
Mapa conceptual de administracionMapa conceptual de administracion
Mapa conceptual de administracion
diana251994
 
Caracteristicas administracion
Caracteristicas administracionCaracteristicas administracion
Caracteristicas administracion
Servicios Académicos Digitales - SAD
 
FASES DE LA ADMINISTRACIÓN (CONTROL)
FASES DE LA ADMINISTRACIÓN (CONTROL)FASES DE LA ADMINISTRACIÓN (CONTROL)
FASES DE LA ADMINISTRACIÓN (CONTROL)
Eliseo Gomez
 

Destaque (18)

El empresario y sus habilidades de trabajo
El empresario y sus habilidades de trabajoEl empresario y sus habilidades de trabajo
El empresario y sus habilidades de trabajo
 
Proceso administrativo
Proceso administrativoProceso administrativo
Proceso administrativo
 
áReas funcionales de la empresa
áReas funcionales de la empresaáReas funcionales de la empresa
áReas funcionales de la empresa
 
Pepsico
PepsicoPepsico
Pepsico
 
Mapa Conceptual Administracion Publica y Privada
Mapa Conceptual Administracion Publica y PrivadaMapa Conceptual Administracion Publica y Privada
Mapa Conceptual Administracion Publica y Privada
 
La Empresa, äreas funcionales y administrativas
La Empresa, äreas funcionales y administrativasLa Empresa, äreas funcionales y administrativas
La Empresa, äreas funcionales y administrativas
 
Control administrativo
Control administrativoControl administrativo
Control administrativo
 
Control En Proceso Administrativo
Control En Proceso AdministrativoControl En Proceso Administrativo
Control En Proceso Administrativo
 
La empresa y sus areas funcionales presentacion para defensa
La empresa y sus areas funcionales presentacion para defensaLa empresa y sus areas funcionales presentacion para defensa
La empresa y sus areas funcionales presentacion para defensa
 
Control Diapositivas
Control  DiapositivasControl  Diapositivas
Control Diapositivas
 
Mapa conceptual de administracion
Mapa conceptual de administracionMapa conceptual de administracion
Mapa conceptual de administracion
 
Presentacion control administrativo
Presentacion control administrativoPresentacion control administrativo
Presentacion control administrativo
 
Mapa conceptual de administracion
Mapa conceptual de administracionMapa conceptual de administracion
Mapa conceptual de administracion
 
Caracteristicas administracion
Caracteristicas administracionCaracteristicas administracion
Caracteristicas administracion
 
Etapas de la Administración-Dirección
Etapas de la Administración-DirecciónEtapas de la Administración-Dirección
Etapas de la Administración-Dirección
 
FASES DE LA ADMINISTRACIÓN (CONTROL)
FASES DE LA ADMINISTRACIÓN (CONTROL)FASES DE LA ADMINISTRACIÓN (CONTROL)
FASES DE LA ADMINISTRACIÓN (CONTROL)
 
PROCESO DE ADMINISTRACIÓN: DIRECCIÓN Y CONTROL
PROCESO DE  ADMINISTRACIÓN: DIRECCIÓN Y CONTROLPROCESO DE  ADMINISTRACIÓN: DIRECCIÓN Y CONTROL
PROCESO DE ADMINISTRACIÓN: DIRECCIÓN Y CONTROL
 
CONTROL en el Proceso Administrativo
CONTROL en el Proceso AdministrativoCONTROL en el Proceso Administrativo
CONTROL en el Proceso Administrativo
 

Semelhante a 2008.07.17 발표

Persisting Your Objects In The Database World @ AlphaCSP Professional OSS Con...
Persisting Your Objects In The Database World @ AlphaCSP Professional OSS Con...Persisting Your Objects In The Database World @ AlphaCSP Professional OSS Con...
Persisting Your Objects In The Database World @ AlphaCSP Professional OSS Con...
Baruch Sadogursky
 
Architecting Web Services
Architecting Web ServicesArchitecting Web Services
Architecting Web Services
Lorna Mitchell
 
RESTful services with JAXB and JPA
RESTful services with JAXB and JPARESTful services with JAXB and JPA
RESTful services with JAXB and JPA
Shaun Smith
 
RESTful Data Access Services with Java EE
RESTful Data Access Services with Java EERESTful Data Access Services with Java EE
RESTful Data Access Services with Java EE
Shaun Smith
 
NEOOUG 2010 Oracle Data Integrator Presentation
NEOOUG 2010 Oracle Data Integrator PresentationNEOOUG 2010 Oracle Data Integrator Presentation
NEOOUG 2010 Oracle Data Integrator Presentation
askankit
 
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic Communication
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic CommunicationIQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic Communication
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic Communication
Ted Leung
 

Semelhante a 2008.07.17 발표 (20)

Entity Persistence with JPA
Entity Persistence with JPAEntity Persistence with JPA
Entity Persistence with JPA
 
Struts2
Struts2Struts2
Struts2
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2
 
Slice: OpenJPA for Distributed Persistence
Slice: OpenJPA for Distributed PersistenceSlice: OpenJPA for Distributed Persistence
Slice: OpenJPA for Distributed Persistence
 
Persisting Your Objects In The Database World @ AlphaCSP Professional OSS Con...
Persisting Your Objects In The Database World @ AlphaCSP Professional OSS Con...Persisting Your Objects In The Database World @ AlphaCSP Professional OSS Con...
Persisting Your Objects In The Database World @ AlphaCSP Professional OSS Con...
 
Struts2
Struts2Struts2
Struts2
 
JEST: REST on OpenJPA
JEST: REST on OpenJPAJEST: REST on OpenJPA
JEST: REST on OpenJPA
 
I Feel Pretty
I Feel PrettyI Feel Pretty
I Feel Pretty
 
Itemscript, a specification for RESTful JSON integration
Itemscript, a specification for RESTful JSON integrationItemscript, a specification for RESTful JSON integration
Itemscript, a specification for RESTful JSON integration
 
Basic Hibernate Final
Basic Hibernate FinalBasic Hibernate Final
Basic Hibernate Final
 
Os Leonard
Os LeonardOs Leonard
Os Leonard
 
Architecting Web Services
Architecting Web ServicesArchitecting Web Services
Architecting Web Services
 
Pxb For Yapc2008
Pxb For Yapc2008Pxb For Yapc2008
Pxb For Yapc2008
 
RESTful services with JAXB and JPA
RESTful services with JAXB and JPARESTful services with JAXB and JPA
RESTful services with JAXB and JPA
 
RESTful Data Access Services with Java EE
RESTful Data Access Services with Java EERESTful Data Access Services with Java EE
RESTful Data Access Services with Java EE
 
Introduction to Datastore
Introduction to DatastoreIntroduction to Datastore
Introduction to Datastore
 
Java Web Programming on Google Cloud Platform [2/3] : Datastore
Java Web Programming on Google Cloud Platform [2/3] : DatastoreJava Web Programming on Google Cloud Platform [2/3] : Datastore
Java Web Programming on Google Cloud Platform [2/3] : Datastore
 
NEOOUG 2010 Oracle Data Integrator Presentation
NEOOUG 2010 Oracle Data Integrator PresentationNEOOUG 2010 Oracle Data Integrator Presentation
NEOOUG 2010 Oracle Data Integrator Presentation
 
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic Communication
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic CommunicationIQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic Communication
IQPC Canada XML 2001: How to Use XML Parsing to Enhance Electronic Communication
 
Jsp
JspJsp
Jsp
 

Último

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Último (20)

Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 

2008.07.17 발표

  • 1.
  • 2.
  • 3.
  • 4.
  • 5. TopLink 구성요소 Standalone J2SE application Environment TopLink Workbench (GUI Tool)
  • 6.
  • 7.  
  • 8.
  • 9. TopLink 의 기능 (1) <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> <toplink-sessions version=&quot;10g Release 3 (10.1.3.3.0)&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;> <session xsi:type=&quot;database-session&quot;> <name>examples.ox.model</name> <event-listener-classes/> <primary-project xsi:type=&quot;xml&quot;>/home/all4you/tmp/xmlmapping/classes/CustomerProject.xml</primary-project> <login xsi:type=&quot;xml-login&quot;/> </session> </toplink-sessions>~ <opm:class-mapping-descriptor xsi:type=&quot;toplink:xml-class-mapping-descriptor&quot;> <opm:class>examples.ox.model.Address</opm:class> <opm:alias>Address</opm:alias> <opm:events xsi:type=&quot;toplink:event-policy&quot;/> <opm:querying xsi:type=&quot;toplink:query-policy&quot;/> <opm:attribute-mappings> ............................................ <opm:attribute-mapping xsi:type=&quot;toplink:xml-direct-mapping&quot;> <opm:attribute-name>province</opm:attribute-name> <opm:field name=&quot;state/text()&quot; xsi:type=&quot;toplink:node&quot;/> <opm:converter xsi:type=&quot;toplink:object-type-converter&quot;> <toplink:type-mappings> <toplink:type-mapping> <toplink:object-value xsi:type=&quot;xsd:string&quot;>Alaska</toplink:object-value> <toplink:data-value xsi:type=&quot;xsd:string&quot;>AK</toplink:data-value> </toplink:type-mapping> <toplink:type-mapping> <toplink:object-value xsi:type=&quot;xsd:string&quot;>Arkansas</toplink:object-value> <toplink:data-value xsi:type=&quot;xsd:string&quot;>AR</toplink:data-value> </toplink:type-mapping> </toplink:type-mappings> </opm:converter> </opm:attribute-mapping> </opm:attribute-mappings> Project myProject = session.getProject(); XMLContext context = new XMLContext(myProject); XMLMarshaller marshaller = context.createMarshaller(); marshaller.marshal(myObject, outputStream); marshaller.setFormattedOutput(true); XMLUnmarshaller unmarshaller = context.createUnmarshaller(); Employee emp = (Employee)unmarshaller.unmarshal(new File(&quot;employee.xml&quot;)); XMLValidator validator = context.createValidator(); boolean isValid = validator.validate(emp);
  • 10.
  • 11. TopLink 의 기능 (2) <session xsi:type=&quot;database-session&quot;> <name>advancedtutorial</name> <event-listener-classes/> <primary-project xsi:type=&quot;xml&quot;>/home/all4you/tmp/adtutorial/src/META-INF/project.xml</primary-project> <login xsi:type=&quot;database-login&quot;> <platform-class>oracle.toplink.platform.database.oracle.Oracle10Platform</platform-class> <user-name>scott</user-name> <password>3E20F8982C53F4ABA825E30206EC8ADE</password> <sequencing> <default-sequence xsi:type=&quot;table-sequence&quot;> <name>Default</name> </default-sequence> </sequencing> <driver-class>oracle.jdbc.driver.OracleDriver</driver-class> <connection-url>jdbc:oracle:thin:@192.168.1.43:1532:ora10g</connection-url> </login> </session> </toplink-sessions> <opm:class-mapping-descriptors> <opm:class-mapping-descriptor xsi:type=&quot;toplink:relational-class-mapping-descriptor&quot;> <opm:class>example.model.PhoneNumber</opm:class> <opm:alias>PhoneNumber</opm:alias> <opm:primary-key> <opm:field table=&quot;PHONE&quot; name=&quot;EMP_ID&quot; xsi:type=&quot;opm:column&quot;/> <opm:field table=&quot;PHONE&quot; name=&quot;TYPE&quot; xsi:type=&quot;opm:column&quot;/> </opm:primary-key> UnitOfWork uow = session.acquireUnitOfWork(); try { Employee employee = createEmployee(first, last, salary); Address address = createAddress(city, street); employee.setAddress(address); uow.registerNewObject(employee); uow.commit(); } finally { uow.release(); }
  • 12.
  • 13.
  • 14.
  • 15. How to Use JPA @Entity @NamedQuery(name=&quot;findAllProducts&quot;, query=&quot;SELECT p FROM Product p&quot;) public class Product implements Serializable { @Id private String productId; private double price; private String description; public Product() { } public Product(String productId, double price, String description){ this.productId = productId; this.price = price; this.description = description; } public String getProductId() { return productId; } public void setProductId(String id) { this.productId = id; } <persistence version=&quot;1.0&quot; xmlns=&quot;http://java.sun.com/xml/ns/persistence&quot;> <persistence-unit name=&quot;hellojpa&quot; transaction-type=&quot;JTA&quot;> <jta-data-source>datasource1</jta-data-source> <!--<jta-data-source>jdbc/sample</jta-data-source>--> <properties/> </persistence-unit> </persistence> @PersistenceContext private EntityManager em; ..... public Product createProduct(String productId, double price, String desc){ Product product = new Product(productId, price, desc); em.persist(product); return product; } public Product getProduct(String productId){ return (Product) em.find(Product.class, productId); }
  • 16. XML Mapping Relational Mapping EIS Mapping Oracle TopLink TopLink Essentials glassfish jeus-toplink-essentials.jar JEUS 6
  • 17.