Friday, September 21, 2007

Tip-tip hibernate


  1. Gunakan version yang terkini walaupun beta and banyak feature² baru menarik dan berguna.. senang cerita gunakan Hibernate 3.
  2. Buat semua associations lazy(Hibernate 3 telah setkannya secara default) dan pilih utk join atau fetch secara eager utk spesifik use-case.
  3. Definasikan strategi pengurusan session terlebih dahulu. Mungkin, kita akan menggunakan
    1. satu session per request,
    2. session per request with detached objects,
    3. session per application transaksi acros multiple request, dll.
  4. Definisikan startegi flush terlebih dahulu.
    1. Hibernate auto-flush
    2. definisikan sendiri synchronization points di mana flush ke db diperlukan
  5. Definisikan strategi caching terlebih dahulu utk
    1. data transaksi
    2. data yg dillookup tetapi berubah² utk dlm short period.. gunakan open source product spt OSCache.
  6. Cachekan entiti-entiti anda dan pastikan ia turut diaplikasikan kepada association mapping spt(set,map,bag,list)
  7. Pilih join yg betul utk entiti one-to-many, many-to-many associations, set nilai saiz batch
    utk koleksi sekiranya anda mendapatkan data secara eagerly.
  8. Gunakan optimistic concurreny melalui kolum version sekiranya boleh. Timestamp pun boleh juga. tetapi tidak dijamin. selebihnya translate lah sendiri..
  9. Understand the lifecycle of identifier creation. If you are using sequences or other database-generated identifiers, your identifiers won't be set until the new entity has been saved to the database. If you use the identifier as part of your equals() and hashCode() implementation, this means that if you add the entity to a Set before you save it, you won't be able to find it again after it's saved. I've gone to UUIDs assigned in the constructor of the entity instances for this reason, and it makes life much easier. I've heard that some people, faced with this, have made their hashCode() implementation always return the same number for every instance of an entity. While this technically fulfills the contract of hashCode() it's hardly optimal.
  10. Set your IDE up with a reference to the Hibernate source code of the distribution you are using so you can trace into it. Not only will it help you understand what's causing the behavior you're seeing, but it will help you understand how Hibernate works.
  11. Understand the 2nd level cache (and understand that the Session is your 1st level cache). Understand how it caches your entity data (as a Map of identifier to Array of field values) and collections (it just saves the identifiers and re-constitutes the objects from the entity cache).
  12. Go buy Hibernate in Action. It covers Hibernate 2.1 but the ideas are the same, there are just some new features in 3.0.
  13. Speaking of new features, look at Filters. I haven't had a chance to use them yet, but the mere fact that they make the effective date problem so easy makes them a huge win. They can also let you find the number of records in a collection, etc. without having to load the whole thing, very nice.
  14. Baseline your first working setup with memory and CPU profilers and also with a SQL profiler like IronTrack SQL, then re-run your test cases with the profilers for every configuration tweak to see what the effects are.

Tuesday, September 11, 2007

http://openjnlp.nanode.org/app-list.html

http://openjnlp.nanode.org/app-list.html

Looking for Smart Client Container for java

Currently, I am looking the smart client container which support on-line and off-line mode.. The smart client is actually combination of thin and rich client.. The web browser is not a smart client.. becoz it never go to school :D.. the smart client should adopt with the SOA..

finally i found the smart client container for java, it also for me..

http://smartcc.sourceforge.net/

but... :(

then, i found another demo of smart client container for java

http://www.vlsolutions.com/en/products/docking/demos.php

I hope i can implement Smart Client + SOA in the future project :D

Who is the Follower, Who is the Leader

Last few days, i got a seminar. All is about IT Technologies.. That event was made me feel good if i could managed myself into their world.. I really impressed with 1st demo and 2nd demo. Actually, I was really like the topic than the demo actually. 1st Topics is Enterprise Pattern and Testability. The presenter was impressed me by one of his demo that i called the refactoring process. Actually, That demos was including Nunit. oppp.. not Nunit but their unit testing so called.. The presenter was show their ability to refactoring the codes from top-down code into the nice code with unit tests together. Nice codes means.. it difficult to say about nice codes.. may be u can googling the meaning of "Nice Codes".. I was impressed that demo.. It was like booooom.. wah... nice.. nice...nice.. It was like a master of kungfu show the powerful movements...

But.. when i was on the way to my home, my brains was thinking about the moving of another new world but.. The key is... who is the leader.. who is the follower... of these concepts. So... it made me to stay in the current line and will not plan to moving into the another world...

Morale of the story..
next time, I will only impress when i see the successful real-world scenario project which is brought a lot of complexity into the system.. actually, the simple demo always not covers the difficult or complex parts.

Wednesday, September 5, 2007

Blinq.. for ASP .NET Fan club

Today, i found new framework. It Is Blinq.
Actually, Blinq is a tool for generating ASP.NET websites for displaying, creating, and manipulating data based on database schema.

More details on the below link
http://www.asp.net/downloads/sandbox/blinq/

erm... My Code gen can do same workloads.

Tuesday, September 4, 2007

Misi Projek Rahsia Terbongkar...

Berikut ada details ttg Projek Rahsia Saya

Nama Misi:
Code Generator

Nama Kod :
Tanpa Nama (Boleh beri cadangan)

Objektif :
Menyelesaikan semua permasalahan CRUD (Create, Read, Update, Delete ) dengan mudah.
Kod-Kod tersebut boleh diguna semula di dalam komponen yang lain. senang dipakai.

Bahan² :
1.5 kg Hibernate
1 kg Spring
3kg Webwork
0.5 kg CSS
0.5 kg js
1 kg ajax framework( akan datang)
1.5 kg velocity

*kg adalah pemberat pengetahuan yg diperlukan di sini...

Tarikh Mula:
07/07/2007 (agak² jer, tp sebelum bos pergi)

Tarikh Tamat:
dah bosan, mungkin tamat kut..

Pencapaian:
Fasa 1 sudah selesai. Fasa 1 merangkumi simple CRUD utk Simple Domain. Fasa 1 dah berjaya didemokan kepada guru yahaya

Fasa 2 akan cover utk domain yg lebih kompleks yang melibatkan One-to-Many. Many-to-One.

Komitment:
Insyallah, satu bulan satu kejayaan.. berbulan² byk la kejayaan yg dicapai.. setahun.. kejayaan yg besar akan di capai...

Cadangan utk diri saya:
Akan saya ceritakan dari A-Z ttg perkembagan misi ini.
Perlu dinaikan taraf open source ke projek ini..

Cadangan pada masa depan
Akan menyokong MVP/ MVC (.NET Framework)

Monday, September 3, 2007

Sudah Satu Tahun Di Sini.. Tahun Depan Ke mana pulak?

wah... pejam celik pejam celik.... sudah satu tahun daaa... rasa mcm sekejap jer keje kat sini..
Biasa la, bila rasa sekejap tu .. mungkin sebab keje byk sangat sampai tak ingat hari bulan...
Sudah satu tahun di Sini.. Apa yg saya dapat yer.. erm.. actually, banyak juga yg saya belajar di sini antaranya... ( muhasabah diri sket)
1. Hibernate
dulu mmg tercari² gak sifoo utk belajar benda ini

2. web framework
webwork la.. dulu buat struts mcm tak best jer.. sbb byk sgt configuration

3. Spring
sama kes mcm no 1. .. saya pakai utk ioc + sket lg aop kut

4. Junit
nak lengkapkan cycle development mesti ada testing.. so, tools ini mmg bagus la.

5. Agile Development... pergh.. ni mmg best la.. kita akan belajar mcmana nak perbnykkan produktiviti kita di dlm s/w industry.

6. Jasper Report.. ini lagi best... dulu pakai poi tak best sgt..

7. Uml Notation - Di Sini, semua document diimplementkan di dlm bentuk UML ...

8. Design Pattern.. best owww.. Antaranya Configuration Over Convention ada byk lagi nih..

9. Akhir sekali, Code Generator la.. hehehehe Sifoo punya dasyat gak.. dulu tak mampu nak buat sendiri sbb tak cukup ilmu, masa & pengalaman..Seblm sifoo saya pergi, sempat la gak minta jasa baik sifoo beri tunjuk ajar sedikit ttg code generator nih... Akhirnya hari ini saya sudah berjaya membuat code generator utk simple domain + crud.. Code generator saya berasaskan Webwork + Hibernate + Spring.. akan datang saya akan cuba utk complex domain..

10. Subjek.. Berterima Kasih.. Saya Berterima kasih kepada kawan² yg membantu saya...

So inilah yg saya dapat di sini selama 1 tahun.. so tahun depan ke mana la yer????