What difference between Hibernate and MyBatis

MyBatis 

  • Best used when you need complete control of the SQL.
  • Useful when the SQL queries need to be fine-tuned.
  • Should NOT be used when full control of both application and database design. Because in this case application could be modified to suit the database or vice versa.
  • Reverted ORM
  • Not support non-relational database

Hibernate 

  • Best when you have full control of both application and database. You can tune application to suit database or vice versa.
  • Best option of programmer who are less familiar to SQL
  • [Could use createNativeQuery() in EntityManager to control Query]

 

Q&A

What difference between JPA and Hibernate? 

Hibernate is an implementation while JPA is a specification.

Is MyBatis an ORM mapper?

Unlike ORM framework, MyBatis map Java Object to SQL.

 

Disadvantage of Different JPA

Hibernate

Too much magic

MyBastis

More time in development and maintenance (Have to rewrite all query if object mode change)

 

 

Raspberry Pi and Arduino

Raspberry Pi 2 Model B

Dimension: 85.60 mm × 56.5 mm (not including protruding connectors)

Price: US$35 (HK$297.00 From: http://hkcn.rs-online.com/web/)

Raspberry Pi 2 Model B v1.1 top new (bg cut out).jpg

•32-bit ARM Cortex-A7 processor supports all the latest ARM GNU/LINUX distributions such as Snappy Ubuntu and Microsoft Windows 10

Ram: 1 GB (shared with GPU)

USB 2.0 Port: 4

Video Output: HDMI

Arduino UNO

Web Page: https://www.arduino.cc/

Price: €20.00 (From: https://store.arduino.cc/product/GBX00066)

 

Enterprise Design and Architecture

From: https://msdn.microsoft.com/en-us/library/aa267045(v=vs.60).aspx

What is Enterprise Application?

It is big business application. In short, It is a highly complex system.

 

Enterprise Application Model

It is summation of all requirements that contribute to implementing every enterprise application.

 

Enterprise Development Teams and Process

There are many difference development and project management strategy .

 

A Model for Enterprise Teams 

Six Team Roles 

Example of Sharing project roles

Project Reporting Structure

 

 

 

Windows – Technology For Application Development

To build a new application, the first decision is whether to use Win32 and COM API or .Net. Both options can let you create desktop app. The major difference is as below.

 

.Net High Productive
Win32 and COM API High Performance

From:

https://msdn.microsoft.com/library/windows/desktop/dn614993.aspx

https://dev.windows.com/en-us/desktop/getstarted

Technology for Window Desktop Application Development

Win32 and COM Build desktop applications and services using the core Windows APIs to leverage the performance and flexibility of the operating system.
.NET Build and run the next generation of desktop applications and XML web services with this comprehensive and consistent programming model.
WPF Create desktop and browser-hosted applications using a resolution-independent, vector-based engine to take advantage of modern graphics hardware.
Azure Build, deploy, and manage applications and PaaS/IaaS services through a global network of Microsoft-managed data centers.

HTML5

HTML5 Overview

It is specification by World Wide Web Consortium (W3C). It has introduced new markup, new APIs that can be called by Javascript, XHTML5.

New HTML5 API

  • HTML Geolocation
  • HTML Drag and Drop
  • HTML Local Storage
  • HTML Application Cache
  • HTML Web Workers
  • HTML SSE

Index – Performance Tuning

An index is a copy of select columns of data from a table that can be searched very efficiently that also includes a low-level disk block address or direct link to the complete row of data it was copied from.

Therefore, it improves the speed of data retrieval operations on a database table at the cost of additional writes and storage space to maintain the index data structure.

From: https://en.wikipedia.org/wiki/Database_index

 

Related Reading

Apache Lucene

https://lucene.apache.org/core/

 

PL/SQL Cursors

Introduction

Cursor can be viewed as a pointer to one row in a set of rows.

 

Type of Cursor

  • Implicit cursors
  • Explicit cursors

 

Attribute of Cursor

  • %NOTFOUND
  • %FOUND
  • %ROWCOUNT
  • %ISOPEN

 

Example Of Explicit Cursor

SET SERVEROUTPUT ON;

DECLARE
  CURSOR USER_TABLES_CURSOR IS SELECT TABLE_NAME FORM USER_TABLES;
  TABLE_NAME VARAHCR(100);
BEGIN
  OPEN USER_TABLES_CURSOR;
    LOOP
      FETCH USER_TABLES_CURSOR INTO TABLE_NAME;
      EXIT WHEN USER_TABLES_CURSOR%NOTFOUND;
      DBMS_OUTPUT.PUT_LINE(TABLE_NAME); 
    END LOOP;
  CLOSE USER_TABLES_CURSOR;
END;
/

 

Example of Implicit Cursor

SET SERVEROUTPUT ON;
DECLARE
  TYPE USER_TABLES_CUR_TYP IS REF CURSOR;
  USER_TABLES_CURSOR USER_TABLES_CUR_TYP;
  TABLE_NAME VARCHAR2(100);
BEGIN
  OPEN USER_TABLES_CURSOR FOR 'SELECT TABLE_NAME FROM USER_TABLES WHERE ROWNUM = 1';
  LOOP
    FETCH USER_TABLES_CURSOR INTO TABLE_NAME;
    EXIT WHEN USER_TABLES_CURSOR%NOTFOUND;
    DBMS_OUTPUT.PUT_LINE(TABLE_NAME);
  END LOOP;
  CLOSE USER_TABLES_CURSOR;
END;
/

 

 Cursor Update

 

SET SERVEROUTPUT ON;

DECLARE
  CURSOR USER_TABLES_CURSOR IS 
    SELECT TABLE_NAME FORM TEST_TABLES FOR UPDATE OF TABLE_NAME;
  TABLE_NAME VARAHCR(100);
BEGIN
  OPEN TEST_TABLES_CURSOR;
  LOOP
    FETCH TEST_TABLES_CURSOR INTO TABLE_NAME;
    EXIT WHEN USER_TABLES_CURSOR%NOTFOUND;
    DBMS_OUTPUT.PUT_LINE(TABLE_NAME); 
    UPDATE TEST_TABLES
    SET TABLE_NAME = 'TEST 1'
    WHERE CURRENT OF TEST_TABLES_CURSOR;
  END LOOP;
  CLOSE TEST_TABLES_CURSOR;
END;
/

 

 

 

 

 

 

 

 

PL/SQL Anonymous Block

PL/SQL is a combination of SQL along with the procedural features of programming languages.

The procedural programming is coded within BEGIN .. END;. The procedural block can be with variables or without variables.

1. Without Variables

set serveroutput on;
Begin
dbms_output.put_line('Hello World');
End;

2. With Variable


set serveroutput on;
declare
 var varchar2(50);
begin
 select 'Hello World' into VAR from DUAL;
 dbms_output.put_line(var);
end;

 

Use SQL Developer to Press “F5″ to execute it.

Image 002