Java: Hibernate Mapping Tool


Jika dikau berkecimpung dengan java, dan sering bergulat ama Sun/JBoss application server & Hibernate, pasti pernah ngerasain sebel-nya mapping table/view satu-satu ke dalam hibernate object class, dan juga .xml mappingnya.

Tool hasil ketikan daku berikut dapat dipastikan amat sangat membantu dikau melakukan proses ini semua, support all recognized database by ZeosDB 😀

Hibernate Mapping Tool

contoh class berikut adalah hasil generating otomatis:

001 package com.indosat.hbm;
002
003 import java.util.Date;
004
005 public class TDatasource implements java.io.Serializable {
006
007 private int tDatasourceId;
008 private String datasourceName;
009 private String lookupTable;
010 private String keyField;
011 private String valueField;
012 private String sqlQuery;
013 private String createBy;
014 private Date createDate;
015 private String updateBy;
016 private Date updateDate;
017
018 public TDatasource() {
019 }
020
021 public int getTDatasourceId() {
022 return this.tDatasourceId;
023 }
024
025 public void setTDatasourceId(int tDatasourceId) {
026 this.tDatasourceId=tDatasourceId;
027 }
028
029 public String getDatasourceName() {
030 return this.datasourceName;
031 }
032
033 public void setDatasourceName(String datasourceName) {
034 if (datasourceName!=null && datasourceName.length()>30)
035 datasourceName=datasourceName.substring(0, 30);
036 this.datasourceName=datasourceName;
037 }
038
039 public String getLookupTable() {
040 return this.lookupTable;
041 }
042
043 public void setLookupTable(String lookupTable) {
044 if (lookupTable!=null && lookupTable.length()>30)
045 lookupTable=lookupTable.substring(0, 30);
046 this.lookupTable=lookupTable;
047 }
048
049 public String getKeyField() {
050 return this.keyField;
051 }
052
053 public void setKeyField(String keyField) {
054 if (keyField!=null && keyField.length()>30)
055 keyField=keyField.substring(0, 30);
056 this.keyField=keyField;
057 }
058
059 public String getValueField() {
060 return this.valueField;
061 }
062
063 public void setValueField(String valueField) {
064 if (valueField!=null && valueField.length()>30)
065 valueField=valueField.substring(0, 30);
066 this.valueField=valueField;
067 }
068
069 public String getSqlQuery() {
070 return this.sqlQuery;
071 }
072
073 public void setSqlQuery(String sqlQuery) {
074 if (sqlQuery!=null && sqlQuery.length()>1024)
075 sqlQuery=sqlQuery.substring(0, 1024);
076 this.sqlQuery=sqlQuery;
077 }
078
079 public String getCreateBy() {
080 return this.createBy;
081 }
082
083 public void setCreateBy(String createBy) {
084 if (createBy!=null && createBy.length()>12)
085 createBy=createBy.substring(0, 12);
086 this.createBy=createBy;
087 }
088
089 public Date getCreateDate() {
090 return this.createDate;
091 }
092
093 public void setCreateDate(Date createDate) {
094 this.createDate=createDate;
095 }
096
097 public String getUpdateBy()&;nbsp;{
098 return this.updateBy;
099 }
100
101 public void setUpdateBy(String updateBy) {
102 if (updateBy!=null && updateBy.length()>12)
103 updateBy=updateBy.substring(0, 12);
104 this.updateBy=updateBy;
105 }
106
107 public Date getUpdateDate() {
108 return this.updateDate;
109 }
110
111 public void setUpdateDate(Date updateDate) {
112 this.updateDate=updateDate;
113 }
114 }

Contoh xml mappingnya:
buset… gimana cara nampilin berkas XML ya… tulooong…
hehe akhirnya bisa namun cukup berantakan hasilnya 😀

<?xml version=”1.0″ encoding=”iso-8859-1″?>
<!DOCTYPE hibernate-mapping PUBLIC “-//Hibernate/Hibernate Mapping DTD 3.0//EN” “http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd”&gt;
<hibernate-mapping>
<class name=”com.indosat.hbm.TDatasource” table=”T_DATASOURCE”>
<id name=”TDatasourceId” type=”int”>
<column name=”T_DATASOURCE_ID” length=”4″/>
<generator class=”sequence”;>
<param name=”sequence”>T_DATASOURCE_SEQUENCE</param>
</generator>
</id>
<property name=”DatasourceName” type=”java.lang.String”>
<column name=”DATASOURCE_NAME” length=”31″/>
</property>
<property name=”LookupTable” type=”java.lang.String”>
<column name=”LOOKUP_TABLE” length=”31″/>
</property>
<property name=”KeyField” type=”java.lang.String”>
<column name=”KEY_FIELD” length=”31″/>
</property>
<property name=”ValueField” type=”java.lang.String”>
<column name=”VALUE_FIELD” length=”31″/>
</property>
<property name=”SqlQuery” type=”java.lang.String”>
<column name=”SQL_QUERY” length=”1025″/>
</property>
<property name=”CreateBy” type=”java.lang.String”>
<column name=”CREATE_BY” length=”13″/>
</property>
<property name=”CreateDate” type=”java.util.Date”>
<column name=”CREATE_DATE” length=”4″/>
</property>
<property name=”UpdateBy” type=”java.lang.String”>
<column name=”UPDATE_BY” length=”13″/>
</property>
<property name=”UpdateDate” type=”java.util.Date”>
<column name=”UPDATE_DATE” length=”4″/>
</property>
</class>
</hibernate-mapping>

Download

Hibernate Mapping Tool 0.5 - MCK
Hosted by eSnips
Advertisements
  1. March 15, 2007 at 7:51 am

    sipp.. sippp tapi webnya kok suwung 😛
    gak ono sisi liyane po..?

  2. March 15, 2007 at 8:27 am

    Hubungannya ama “all recognized database of ZeosDB” apa ya bro..? kok kayaknya maksudnya implisit.

  3. March 15, 2007 at 8:39 am

    ngga’ peduli … maksudnya sih bisa membuat konfigurasi/connect dari semua jenis database yg disupport ama ZeosDB xixix 🙂

  4. Gustaman
    March 15, 2007 at 10:53 am

    pajang gambar cewek dong…biar gw rajin surf ke sini. 🙂

  5. March 16, 2007 at 7:02 am

    keliatannya sih bagus cuman daku males mo testnya harus……..
    coba ada exe yg bisa di download/sample dari delphi, gwe pasti lebih semangat dechhhhh.

  6. March 16, 2007 at 12:24 pm

    sudah daku upload file-nya. silahkan dicicipi… 🙂

  7. Manz
    April 10, 2007 at 7:59 am

    @Gustaman …. cewek gw ajah dach yang di delphi di publish ke sini …. huahahahahaaha

  8. ijoe
    April 18, 2007 at 4:33 pm

    Hore… aku bisa tulis comment di sini!

  9. May 15, 2007 at 1:25 am

    lumayan ni om, tp aku kok lebih sneng script langsung aja y.. uda ngerti sih.. maklum, laporan hasil praktek kmaren aku ambil tema mapping hibernate+xddoclet…

  10. nirwana sembilan benua
    May 16, 2007 at 10:30 am

    mas exe diletakan dimana ?…..
    biar keren n userfrendly exe letakan aja disetiap halaman…
    (so…bagi-bagiilmunya jadi 100 % )

  11. July 23, 2008 at 7:58 am

    Mas gitaris cadas, .. blogroll nya tambahin punyaku yah. .. biar numpang keren kaya sampeyan!!
    Tapi jangan di bandingin lho. .
    aku masih di bawah … jauh .. auh .. uh ..h (asli ini echo ..)

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: