JECO.J

Information Technology ( IT Consulting, Project Management, System Analysis and Design, Programming

Why JPA?

Posted by jecosen on July 12, 2009

A fundamental question for many Java developers is “Why JPA? Why do I need to know how to use this API when object-relational mapping tools like Hibernate and Toplink are already available?”

The answer is that JPA is not a new technology; rather, it has collected the best ideas from existing persistence technologies like Hibernate, TopLink, and JDO. The result is a standardized specification that helps you build a persistence layer that is independent of any particular persistence provider.

Recommended Book for JPA :

Book Details

Pro EJB 3: Java Persistence API book cover

  • By Mike Keith , Merrick Schincariol
  • ISBN13: 9781590596456
  • ISBN10: 1590596455
  • 480 pp.
  • Pub Date: 2006-05-08
  • eBook Price: $31.49

EJB 3.0 sets a new precedent. It has made huge advances in ease of development, and its drastically simplified programming model has been widely acclaimed.

Mike Keith, EJB 3.0 co-specification lead, and Merrick Schinariol, reviewer of EJB 3.0, offer unparalleled insight and expertise on the new EJB 3.0 persistence specification, in this definitive guide to EJB 3.0 persistence technology. Expect full coverage and examination of the EJB 3.0 spec from these expert authors, including:

  • The new EntityManager API
  • The new features of EJB Query Language (EJB QL)
  • Basic and advanced object-relational mapping
  • Advanced topics like concurrency, locking, inheritance, and polymorphism

Assuming a basic knowledge of Java, SQL, JDBC, and some J2EE experience, Mike Keith and Merrick Schinariol will teach you EJB 3 persistence from the ground up. After reading it, you will have an in-depth understanding of the EJB 3.0 Persistence API and how to use it in your applications.

Posted in Java Persistence API | Leave a Comment »

Oracle PLSQL – to_char

Posted by jecosen on May 30, 2009

Syntax :

— converts a number or date parameter to a string.

to_char( number_or_date_param , [ format_mask ] , [ nls_language ] )

Version :

Oracle 8i, Oracle 9i, Oracle 10g, Oracle 11g

Example :

NUMBER

– result : 12500.7

SELECT to_char( 12500.78 , ‘9999.9′ ) FROM dual

– result : 12,500.78

SELECT to_char( 12500.78 , ‘9,999.99′ ) FROM dual

– result : $12,500.78

SELECT to_char( 12500.78 , ‘$9,999.00′ ) FROM dual

– result : 0012

SELECT to_char( 12 , ‘0099′ ) FROM dual

DATE : ex. current_date is 2009/12/31

– result : 2009/12/31

SELECT to_char( sysdate , ‘yyyy/mm/dd’ ) FROM dual

– result : December 31, 2009

SELECT to_char( sysdate , ‘Month DD, YYYY’ ) FROM dual

– result : Dec 31th, 2009

SELECT to_char( sysdate , ‘MON DDth, YYYY’ ) FROM dual

– “FM” + format, means that zero blank are suppressed

DATE : ex. current_date is 2009/07/01

– result : Jul 1, 2009 01 –> 1

SELECT to_char( sysdate , FMMON DD, YYYY’ ) FROM dual

Posted in PL / SQL | Tagged: | Leave a Comment »

Oracle PLSQL – Date Format

Posted by jecosen on May 29, 2009

Format Description
YEAR Year, spelled out
YYYY 4-digit year
YYY

YY

Y

Last 3, 2, or 1 digit(s) of year.
IYY

IY

I

Last 3, 2, or 1 digit(s) of ISO year.
IYYY 4-digit year based on the ISO standard
RRRR Accepts a 2-digit year and returns a 4-digit year.

A value between 0-49 will return a 20xx year.

A value between 50-99 will return a 19xx year.

Q Quarter of year (1, 2, 3, 4; JAN-MAR = 1).
MM Month (01-12; JAN = 01).
MON Abbreviated name of month.
MONTH Name of month, padded with blanks to length of 9 characters.
RM Roman numeral month (I-XII; JAN = I).
WW Week of year (1-53) where week 1 starts on the first day of the year and continues to the seventh day of the year.
W Week of month (1-5) where week 1 starts on the first day of the month and ends on the seventh.
IW Week of year (1-52 or 1-53) based on the ISO standard.
D Day of week (1-7).
DAY Name of day.
DD Day of month (1-31).
DDD Day of year (1-366).
DY Abbreviated name of day.
J Julian day; the number of days since January 1, 4712 BC.
HH Hour of day (1-12).
HH12 Hour of day (1-12).
HH24 Hour of day (0-23).
MI Minute (0-59).
SS Second (0-59).
SSSSS Seconds past midnight (0-86399).
FF Fractional seconds. Use a value from 1 to 9 after FF to indicate the number of digits in the fractional seconds. For example, ‘FF4′.
AM, A.M., PM, or P.M. Meridian indicator
AD or A.D AD indicator
BC or B.C. BC indicator
TZD Daylight savings information. For example, ‘PST’
TZH Time zone hour.
TZM Time zone minute.
TZR Time zone region.

Posted in PL / SQL | Tagged: | Leave a Comment »

Oracle PLSQL – to_date

Posted by jecosen on May 29, 2009

Syntax :

– converts a string parameter to a date

to_date ( string_param , [ format_mask ] , [ nls_language ] )

Version :

Oracle 8i, Oracle 9i, Oracle 10g, Oracle 11g


Example :

– result : December 31, 2009

SELECT to_date( ‘31/12/2009′ , ‘dd/mm/yyyy’ ) FROM dual

– result : December 31, 2009

SELECT to_date( ‘20091231′ , ‘yyyymmdd’ ) FROM dual


Posted in PL / SQL | Tagged: | Leave a Comment »

CREATE java.sql.Date & java.sql.Time

Posted by jecosen on May 28, 2009

Syntax :

java.sql.Date sqlDate = new java.sql.Date( new java.util.Date.getTime() );    //  create java.sql.Date

java.sql.Date sqlTime = new java.sql.Time( new java.util.Date.getTime() );    //  create java.sql.Time

Example :

public class Test {

public static void main(String[] args) {

try {

java.util.Date utilDate = new java.util.Date();

java.sql.Date sqlDate = new java.sql.Date( utilDate.getTime() );
System.out.println(“CREATE  java.sql.Date (yyyy-MM-dd)  FROM  java.util.Date  : “ + sqlDate);

java.sql.Time sqlTime = new java.sql.Time( utilDate.getTime() );
System.out.println(“CREATE  java.sql.Time (hh:mm:ss)    FROM  java.util.Date  : ” + sqlTime);

} catch( Exception ex ){

ex.printStackTrace();

}

}

}

Posted in Data Type | Tagged: | Leave a Comment »

COMPARE java.util.Date

Posted by jecosen on May 28, 2009

Syntax :

firstDate.after( secondDate );    // return boolean value ( true or false )

firstDate.before( secondDate );  // return boolean value ( true or false )

Example :

import java.text.SimpleDateFormat;

public class Test {

public static void main(String[] args) {

try{

//    Create a simple date format dd/MM/yyyy
SimpleDateFormat formatter = new SimpleDateFormat(“dd/MM/yyyy”);

//    firstDate = January 01, 2009
java.util.Date firstDate = formatter.parse(“01/01/2009″);

//    secondDate = January 01, 2010
java.util.Date secondDate = formatter.parse(“01/01/2010″);

//    see if firstDate is after secondDate
System.out.println(“firstDate is after secondDate : ” + firstDate.after(secondDate));

//    see if firstDate is before secondDate
System.out.println(“firstDate is before secondDate : “ + firstDate.before(secondDate));

} catch (Exception ex){

ex.printStackTrace();

}

}

}

Posted in Data Type | Tagged: | Leave a Comment »

Create a ( java.util.Date ) object using ( SimpleDateFormat )

Posted by jecosen on May 28, 2009

Syntax :

java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat(“yyyy/MM/dd”);
java.util.Date date = formatter.parse(strDate);

Example :

import java.text.ParseException;
import java.text.SimpleDateFormat;

public class Test {

public static void main(String[] args) {

int year = 2003;
int month = 12;
int day = 12;

String strDate = year + “/” + month + “/” + day;
java.util.Date date = null;

try {

SimpleDateFormat formatter = new SimpleDateFormat(“yyyy/MM/dd”);
date = formatter.parse(strDate);
System.out.println(“Result : “ + date);

} catch (ParseException e) {

System.out.println(e.toString());
e.printStackTrace();

}

}

}

Posted in Data Type | Tagged: | Leave a Comment »

Scheduling Meeting

Posted by jecosen on February 25, 2009

Berikut adalah tips – tips praktis yang ingin saya bagikan kepada para pembaca dalam hal membuat jadwal meeting.
Anda bisa mempertimbangkan dan menyesuaikannya sesuai dengan kondisi yang Anda hadapi.

Peserta
Tuliskanlah siapa saja yang akan berpartisipasi.
Dengan menuliskannya ini akan memudahkan Anda dalam mengundang pesertanya baik melalui email, telp,.

Contoh :
( Disini saya menggunakan Business Card Format. Format bisa apa saja, tergantung selera Anda)
Name : Jecosen Jaya
E-mail : xxxxx@xxxx.com
Phone : 021-xxxxxx
HP : 081x-xxxxx
Address : xxx – Jakarta, Indonesia
Name : x x x x
E-mail : x x x @ x x x . x x x
Phone : 021-xxxxxx
HP : 081x-xxxxx
Address : xxx – xxxx, xxxxx
. . . dan seterusnya

Jadwal dan Tempat
Tentukan lah tanggal, waktu, tempat meeting Anda. Disini dibutuhkan daya pengamatan untuk mengamati waktu luang dan kegiatan peserta Anda pada jam tertentu dalam merencanakan jadwal meeting. Perhatikan juga posisi peserta dengan tempat meeting dan pertimbangkan
kemudahan peserta dalam menghadiri tempat meeting.

Undangan
Tuliskan atau sebutkan informasi meeting dengan jelas pada saat mengundang peserta.

Informasi meeting :
Topik : x x x x
Tanggal : xx/xx/xx
Waktu : xx:xx
Tempat : Jl. xxxx No.xx, Lantai x, Ruang xxx xx

Undanglah minimal 1 minggu sebelum jadwal meeting. Jangan terlalu lama, karena peserta bisa lupa. Dan juga jangan terlalu mendadak, karena bisa jadi peserta akan kesulitan untuk menyesuaikan waktunya.

Pengingat
Pada saat 1 hari sebelum jadwal meeting, pastikan untuk mengingatkan semua peserta dengan
menghubungi peserta dan menyebutkan topik meeting, tanggal, waktu dan tempatnya.

Memang ini terdengar ideal jika dibandingkan dengan implementasi nyata dilapangan. Tetapi dengan berusaha
sebisa-bisanya mengikuti cara ini, hasilnya cukup efektif untuk meningkatkan jumlah kehadiran peserta dan ketepatan waktu dalam mengikuti meeting.
Selamat mencoba ^^

Posted in Meeting | Tagged: | Leave a Comment »