SlideShare a Scribd company logo
Utilized code generation to save our efforts in SAP Integration  Albert Guo [email_address]
Agenda Scenario SAP Implementation Data Access Object Pattern Squirrel SQL Client and DAO4J Summary
Scenario
Scenario
SAP Implementation
SAP Implementation But including the connectivity and data access code within these components  introduces a tight coupling between the components and the data source  implementation.  Such code dependencies in components make it difficult and tedious to  do modification if requirement change.
Data Access Object Pattern
Data Access Object Data Access Object (DAO) is an  object  that provides an abstract  interface  to some type of  database  or persistence mechanism, providing some specific operations without exposing details of the database.  This isolation separates the concerns of what data accesses the application needs, in terms of domain-specific objects and data types (the public interface of the DAO), and how these needs can be satisfied with a specific DBMS, database schema, etc. (the implementation of the DAO). This design pattern is equally applicable to most programming languages, most types of software with persistence needs and most types of database, but it is traditionally associated with  J2EE applications  and with relational databases accessed via the JDBC API because of its origin in Sun Microsystems' best practice guidelines   ("Core  J2EE  Patterns") for that platform.
DAO Structure © 2006 PTC The BusinessObject represents the data client.  It is the object that requires access to the data source to obtain and store data. The DataAccessObject is the primary object of this pattern. The DataAccessObject abstracts the underlying data access implementation for the BusinessObject to enable transparent access to the data source This represents a Transfer Object used as a data carrier This represents a data source implementation. A data source could be a database such as an RDBMS, OODBMS, XML repository, flat file system, and so forth. A data source can also be another system (legacy/mainframe), service (B2B service or credit card bureau), or some kind of repository (LDAP).
Participants and Responsibilities © 2006 PTC Create Read Update, Delete
Strategies - Automatic DAO Code Generation Strategy Automatic  DAO Code Generation Strategy Since each BusinessObject corresponds to a specific DAO, it is possible to establish relationships between the BusinessObject, DAO, and underlying implementations (such as the tables in an RDBMS). Once the relationships are established, it is possible to write a simple application-specific code-generation utility that generates the code for all DAOs required by the application.  © 2006 PTC DAO, DTO Classes SQL Client Code Gen Tool Generated Results
Strategies - Automatic DAO Code Generation Strategy which will generate the following java source files: DTO (Data Transfer Objects): This is the DTO Class  DAO Interface DAO Impl Class © 2006 PTC DAO Interface DAO Impl DTO
Advatnages The advantage of using data access objects is the relatively simple and rigorous separation between two important parts of an application which can and should know almost nothing of each other, and which can be expected to evolve frequently and independently.  Changing business logic can rely on the same DAO interface, while changes to persistence logic do not affect DAO clients as long as the interface remains correctly implemented. In the specific context of the  Java , Data Access Objects can be used to insulate an application from the particularly numerous, complex and varied  Java persistence technologies , which could be  JDBC ,  JDO ,  EJB CMP ,  TopLink ,  Hibernate ,  iBATIS , or many others.  Using Data Access Objects means the underlying technology can be upgraded or swapped without changing other parts of the application.
Implementation Steps Squirrel SQL Client and DAO4J can generate these codes, so we does not need to do from the scratch. We can take it as black box. We just need to focus on workflow design and author business objects. We don’t need to know how to do CRUD.
Squirrel SQL Client and DAO4J
Definition Squirrel SQL Client SQuirreL SQL Client is a graphical Java program that will allow you to view the structure of a JDBC compliant database, browse the data in tables, issue SQL commands etc. The minimum version of Java supported is  1.5.x  as of SQuirreL version 2.4. http://squirrel-sql.sourceforge.net   For more features and screenshots, you can go to  http://squirrel-sql.sourceforge.net/index.php?page=screenshots   DAO4J DAO4J can generate clear and efficient Java source files to populate Database tables via standard JDBC.  http://freehost04.websamba.com/dao4j/   © 2006 PTC
Demo
Demo Select specific table. Right click, then select  Generate DAO . 1
Demo Define code gen  to where Define package name for each class Refer to database specific properties file in dao4j\conf 2
Demo
Class Diagram DAO Interface DTO Class The DTO Class which contains only  the PK fields and can be used as the key of HashMap This table has more than 80-column,  I’ll not show all attributes in class diagram DAO Impl DTO Class
Class Diagram We does not need to know the detail method operation,  just call create method if we need to insert data into  ERP interface table.
Source code snippet . . We just need to focus on how to retrieve all the necessary attributes, and set values to DTO Provide DTO and connection to create  method. Then, everything is done.
ATTENTATION – Poor Exception Handling We need to add catch clause before finally clause
ATTENTATION – Poor Exception Handling
Summary
Benefits Enables Transparency Business objects can use the data source without knowing the specific details of the data source's implementation. Access is transparent because the implementation details are hidden inside the DAO. Reduces Code Complexity in Business Objects Because the DAOs manage all the data access complexities, it simplifies the code in the business objects and other data clients that use the DAOs. All implementation-related code (such as SQL statements) is contained in the DAO and not in the business object. This improves code readability and development productivity. Centralizes All Data Access into a Separate Layer Because all data access operations are now delegated to the DAOs, the separate data access layer can be viewed as the layer that can isolate the rest of the application from the data access implementation. This centralization makes the application easier to maintain and manage. © 2006 PTC
Summary Code Generation We can focus on workflow design,  and retrieve required value and  call DAO method.

More Related Content

PDF
dvprimer-concepts
PPT
Modern Database Development Oow2008 Lucas Jellema
PPTX
Oracle BPM Open Data Services (Part 1)
PPT
Jdbc Dao it-slideshares.blogspot.com
PPTX
Oracle BPM workflow and Open-XDX web services (Part 2)
PDF
Services ax2012
PPTX
Data Binding Unleashed for Composite Applications
PPTX
OData: A Standard API for Data Access
dvprimer-concepts
Modern Database Development Oow2008 Lucas Jellema
Oracle BPM Open Data Services (Part 1)
Jdbc Dao it-slideshares.blogspot.com
Oracle BPM workflow and Open-XDX web services (Part 2)
Services ax2012
Data Binding Unleashed for Composite Applications
OData: A Standard API for Data Access

What's hot (20)

PPTX
How do i connect to that
PDF
Data Virtualization Primer -
PPT
Info sphere overview
PPTX
Overview of atg framework
PPT
Virtuoso ODBC Driver Configuration & Usage (Windows)
PPTX
ATG Architecture
PPTX
Entity Framework Overview
DOCX
A introduction to oracle data integrator
PPT
Exploiting Linked (Open) Data via Microsoft Access using ODBC File DSNs
PPT
Project seminar
PDF
Asp.net interview questions
PPT
Data Enabled Enterprise Modeler (De2 M) Overview V2.12
PPTX
Common Data Service – A Business Database!
PPT
Using Tibco SpotFire (via Virtuoso ODBC) as Linked Data Front-end
PDF
BizTalk Server- Schema
PDF
Odi best-practice-data-warehouse-168255
PPT
ISWC 2012 - Linked Data Meetup
PPTX
Understanding Data
PPTX
Common Data Service (CDS), a new database?
How do i connect to that
Data Virtualization Primer -
Info sphere overview
Overview of atg framework
Virtuoso ODBC Driver Configuration & Usage (Windows)
ATG Architecture
Entity Framework Overview
A introduction to oracle data integrator
Exploiting Linked (Open) Data via Microsoft Access using ODBC File DSNs
Project seminar
Asp.net interview questions
Data Enabled Enterprise Modeler (De2 M) Overview V2.12
Common Data Service – A Business Database!
Using Tibco SpotFire (via Virtuoso ODBC) as Linked Data Front-end
BizTalk Server- Schema
Odi best-practice-data-warehouse-168255
ISWC 2012 - Linked Data Meetup
Understanding Data
Common Data Service (CDS), a new database?
Ad

Similar to Utilized Code Gen To Save Our Efforts In Sap Integration (20)

PDF
Dao pattern
PDF
Flash Camp Chennai - Social network with ORM
PPT
Jdbc Lecture5
PPTX
Dao example
PDF
Green dao
PPSX
ADO.NET
PPTX
Microsoft Data Access Technologies
PPTX
L08 Data Source Layer
PPT
7 data management design
PPTX
4 jdbc step1
PPTX
Getting started with entity framework
PPTX
Navigating NoSQL in cloudy skies
PDF
App301 Implement a Data Access Layer with Ent Lib
PDF
Big Data - architectural concerns for the new age
PDF
Getting to Real-Time in a Multi-Model Architecture
PDF
Overview of Databases and Data Modelling-2.pdf
PPTX
Data Base Design.pptx
PPTX
Benefits of Using MongoDB Over RDBMS (At An Evening with MongoDB Minneapolis ...
PDF
Binder1.pdf
PDF
Data Grids vs Databases
Dao pattern
Flash Camp Chennai - Social network with ORM
Jdbc Lecture5
Dao example
Green dao
ADO.NET
Microsoft Data Access Technologies
L08 Data Source Layer
7 data management design
4 jdbc step1
Getting started with entity framework
Navigating NoSQL in cloudy skies
App301 Implement a Data Access Layer with Ent Lib
Big Data - architectural concerns for the new age
Getting to Real-Time in a Multi-Model Architecture
Overview of Databases and Data Modelling-2.pdf
Data Base Design.pptx
Benefits of Using MongoDB Over RDBMS (At An Evening with MongoDB Minneapolis ...
Binder1.pdf
Data Grids vs Databases
Ad

More from Guo Albert (20)

PPTX
AWS IAM (Identity and Access Management) Policy Simulator
PPTX
TOEIC 準備心得
PDF
DBM專案環境建置
PDF
JPA Optimistic Locking With @Version
PDF
OCEJPA Study Notes
PPTX
OCEJPA(1Z0-898) Preparation Tips
PPTX
JPA lifecycle events practice
PPTX
XDate - a modern java-script date library
PDF
How to avoid check style errors
PDF
NIG系統報表開發指南
PDF
Ease Your Effort of Putting Data into History Table
PDF
NIG 系統開發指引
PDF
NIG系統開發文件閱讀步驟
PDF
Form Bean Creation Process for NIG System
PDF
A Short Intorduction to JasperReports
PPTX
Apply Template Method Pattern in Report Implementation
PPTX
Utilize Commons BeansUtils to do copy object
PPTX
Apply my eclipse to do entity class generation
PPTX
Nig project setup quickly tutorial
PPTX
Spring JDBCTemplate
AWS IAM (Identity and Access Management) Policy Simulator
TOEIC 準備心得
DBM專案環境建置
JPA Optimistic Locking With @Version
OCEJPA Study Notes
OCEJPA(1Z0-898) Preparation Tips
JPA lifecycle events practice
XDate - a modern java-script date library
How to avoid check style errors
NIG系統報表開發指南
Ease Your Effort of Putting Data into History Table
NIG 系統開發指引
NIG系統開發文件閱讀步驟
Form Bean Creation Process for NIG System
A Short Intorduction to JasperReports
Apply Template Method Pattern in Report Implementation
Utilize Commons BeansUtils to do copy object
Apply my eclipse to do entity class generation
Nig project setup quickly tutorial
Spring JDBCTemplate

Recently uploaded (20)

PDF
Solara Labs: Empowering Health through Innovative Nutraceutical Solutions
PPTX
ICG2025_ICG 6th steering committee 30-8-24.pptx
PPT
Chapter four Project-Preparation material
PPTX
Probability Distribution, binomial distribution, poisson distribution
PPTX
HR Introduction Slide (1).pptx on hr intro
PPT
340036916-American-Literature-Literary-Period-Overview.ppt
PPT
Data mining for business intelligence ch04 sharda
PPTX
The Marketing Journey - Tracey Phillips - Marketing Matters 7-2025.pptx
PDF
Nidhal Samdaie CV - International Business Consultant
PPTX
CkgxkgxydkydyldylydlydyldlyddolydyoyyU2.pptx
PPTX
Lecture (1)-Introduction.pptx business communication
PDF
Outsourced Audit & Assurance in USA Why Globus Finanza is Your Trusted Choice
DOCX
unit 1 COST ACCOUNTING AND COST SHEET
PDF
How to Get Funding for Your Trucking Business
PDF
Reconciliation AND MEMORANDUM RECONCILATION
PDF
Roadmap Map-digital Banking feature MB,IB,AB
PDF
Stem Cell Market Report | Trends, Growth & Forecast 2025-2034
PPTX
Dragon_Fruit_Cultivation_in Nepal ppt.pptx
PPTX
Principles of Marketing, Industrial, Consumers,
PDF
DOC-20250806-WA0002._20250806_112011_0000.pdf
Solara Labs: Empowering Health through Innovative Nutraceutical Solutions
ICG2025_ICG 6th steering committee 30-8-24.pptx
Chapter four Project-Preparation material
Probability Distribution, binomial distribution, poisson distribution
HR Introduction Slide (1).pptx on hr intro
340036916-American-Literature-Literary-Period-Overview.ppt
Data mining for business intelligence ch04 sharda
The Marketing Journey - Tracey Phillips - Marketing Matters 7-2025.pptx
Nidhal Samdaie CV - International Business Consultant
CkgxkgxydkydyldylydlydyldlyddolydyoyyU2.pptx
Lecture (1)-Introduction.pptx business communication
Outsourced Audit & Assurance in USA Why Globus Finanza is Your Trusted Choice
unit 1 COST ACCOUNTING AND COST SHEET
How to Get Funding for Your Trucking Business
Reconciliation AND MEMORANDUM RECONCILATION
Roadmap Map-digital Banking feature MB,IB,AB
Stem Cell Market Report | Trends, Growth & Forecast 2025-2034
Dragon_Fruit_Cultivation_in Nepal ppt.pptx
Principles of Marketing, Industrial, Consumers,
DOC-20250806-WA0002._20250806_112011_0000.pdf

Utilized Code Gen To Save Our Efforts In Sap Integration

  • 1. Utilized code generation to save our efforts in SAP Integration Albert Guo [email_address]
  • 2. Agenda Scenario SAP Implementation Data Access Object Pattern Squirrel SQL Client and DAO4J Summary
  • 6. SAP Implementation But including the connectivity and data access code within these components introduces a tight coupling between the components and the data source implementation. Such code dependencies in components make it difficult and tedious to do modification if requirement change.
  • 8. Data Access Object Data Access Object (DAO) is an object that provides an abstract interface to some type of database or persistence mechanism, providing some specific operations without exposing details of the database. This isolation separates the concerns of what data accesses the application needs, in terms of domain-specific objects and data types (the public interface of the DAO), and how these needs can be satisfied with a specific DBMS, database schema, etc. (the implementation of the DAO). This design pattern is equally applicable to most programming languages, most types of software with persistence needs and most types of database, but it is traditionally associated with J2EE applications and with relational databases accessed via the JDBC API because of its origin in Sun Microsystems' best practice guidelines ("Core J2EE Patterns") for that platform.
  • 9. DAO Structure © 2006 PTC The BusinessObject represents the data client. It is the object that requires access to the data source to obtain and store data. The DataAccessObject is the primary object of this pattern. The DataAccessObject abstracts the underlying data access implementation for the BusinessObject to enable transparent access to the data source This represents a Transfer Object used as a data carrier This represents a data source implementation. A data source could be a database such as an RDBMS, OODBMS, XML repository, flat file system, and so forth. A data source can also be another system (legacy/mainframe), service (B2B service or credit card bureau), or some kind of repository (LDAP).
  • 10. Participants and Responsibilities © 2006 PTC Create Read Update, Delete
  • 11. Strategies - Automatic DAO Code Generation Strategy Automatic DAO Code Generation Strategy Since each BusinessObject corresponds to a specific DAO, it is possible to establish relationships between the BusinessObject, DAO, and underlying implementations (such as the tables in an RDBMS). Once the relationships are established, it is possible to write a simple application-specific code-generation utility that generates the code for all DAOs required by the application. © 2006 PTC DAO, DTO Classes SQL Client Code Gen Tool Generated Results
  • 12. Strategies - Automatic DAO Code Generation Strategy which will generate the following java source files: DTO (Data Transfer Objects): This is the DTO Class DAO Interface DAO Impl Class © 2006 PTC DAO Interface DAO Impl DTO
  • 13. Advatnages The advantage of using data access objects is the relatively simple and rigorous separation between two important parts of an application which can and should know almost nothing of each other, and which can be expected to evolve frequently and independently. Changing business logic can rely on the same DAO interface, while changes to persistence logic do not affect DAO clients as long as the interface remains correctly implemented. In the specific context of the Java , Data Access Objects can be used to insulate an application from the particularly numerous, complex and varied Java persistence technologies , which could be JDBC , JDO , EJB CMP , TopLink , Hibernate , iBATIS , or many others. Using Data Access Objects means the underlying technology can be upgraded or swapped without changing other parts of the application.
  • 14. Implementation Steps Squirrel SQL Client and DAO4J can generate these codes, so we does not need to do from the scratch. We can take it as black box. We just need to focus on workflow design and author business objects. We don’t need to know how to do CRUD.
  • 15. Squirrel SQL Client and DAO4J
  • 16. Definition Squirrel SQL Client SQuirreL SQL Client is a graphical Java program that will allow you to view the structure of a JDBC compliant database, browse the data in tables, issue SQL commands etc. The minimum version of Java supported is 1.5.x as of SQuirreL version 2.4. http://squirrel-sql.sourceforge.net For more features and screenshots, you can go to http://squirrel-sql.sourceforge.net/index.php?page=screenshots DAO4J DAO4J can generate clear and efficient Java source files to populate Database tables via standard JDBC. http://freehost04.websamba.com/dao4j/ © 2006 PTC
  • 17. Demo
  • 18. Demo Select specific table. Right click, then select Generate DAO . 1
  • 19. Demo Define code gen to where Define package name for each class Refer to database specific properties file in dao4j\conf 2
  • 20. Demo
  • 21. Class Diagram DAO Interface DTO Class The DTO Class which contains only the PK fields and can be used as the key of HashMap This table has more than 80-column, I’ll not show all attributes in class diagram DAO Impl DTO Class
  • 22. Class Diagram We does not need to know the detail method operation, just call create method if we need to insert data into ERP interface table.
  • 23. Source code snippet . . We just need to focus on how to retrieve all the necessary attributes, and set values to DTO Provide DTO and connection to create method. Then, everything is done.
  • 24. ATTENTATION – Poor Exception Handling We need to add catch clause before finally clause
  • 25. ATTENTATION – Poor Exception Handling
  • 27. Benefits Enables Transparency Business objects can use the data source without knowing the specific details of the data source's implementation. Access is transparent because the implementation details are hidden inside the DAO. Reduces Code Complexity in Business Objects Because the DAOs manage all the data access complexities, it simplifies the code in the business objects and other data clients that use the DAOs. All implementation-related code (such as SQL statements) is contained in the DAO and not in the business object. This improves code readability and development productivity. Centralizes All Data Access into a Separate Layer Because all data access operations are now delegated to the DAOs, the separate data access layer can be viewed as the layer that can isolate the rest of the application from the data access implementation. This centralization makes the application easier to maintain and manage. © 2006 PTC
  • 28. Summary Code Generation We can focus on workflow design, and retrieve required value and call DAO method.