<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;C0EBQXg9fyp7ImA9WhRaFEk.&quot;"><id>tag:blogger.com,1999:blog-2831407981489723026</id><updated>2012-02-17T01:20:50.667Z</updated><title>Monty's Blog</title><subtitle type="html" /><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://mountyahmed.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://mountyahmed.blogspot.com/" /><author><name>Monty</name><uri>http://www.blogger.com/profile/06949879134960499798</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/blogspot/DqDX" /><feedburner:info uri="blogspot/dqdx" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;DkABQXs8eSp7ImA9WxBUGE4.&quot;"><id>tag:blogger.com,1999:blog-2831407981489723026.post-108133394202203973</id><published>2010-03-06T00:18:00.002Z</published><updated>2010-03-06T00:19:10.571Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-06T00:19:10.571Z</app:edited><title>Another update to the database design, hopefully the final</title><content type="html">&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_VM2cMFzoDZc/S5Gfb6_XxTI/AAAAAAAACZY/MOMZHg8Xyt0/s1600-h/last+updated+diagram.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 214px;" src="http://2.bp.blogspot.com/_VM2cMFzoDZc/S5Gfb6_XxTI/AAAAAAAACZY/MOMZHg8Xyt0/s400/last+updated+diagram.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5445308726507980082" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2831407981489723026-108133394202203973?l=mountyahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/fWQFnLJYoR_SoiZsY0XEQmeL6TA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/fWQFnLJYoR_SoiZsY0XEQmeL6TA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/fWQFnLJYoR_SoiZsY0XEQmeL6TA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/fWQFnLJYoR_SoiZsY0XEQmeL6TA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/DqDX/~4/Exv-z3O6Pn4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mountyahmed.blogspot.com/feeds/108133394202203973/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://mountyahmed.blogspot.com/2010/03/another-update-to-database-design.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2831407981489723026/posts/default/108133394202203973?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2831407981489723026/posts/default/108133394202203973?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/DqDX/~3/Exv-z3O6Pn4/another-update-to-database-design.html" title="Another update to the database design, hopefully the final" /><author><name>Monty</name><uri>http://www.blogger.com/profile/06949879134960499798</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_VM2cMFzoDZc/S5Gfb6_XxTI/AAAAAAAACZY/MOMZHg8Xyt0/s72-c/last+updated+diagram.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://mountyahmed.blogspot.com/2010/03/another-update-to-database-design.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0QCSXw8fyp7ImA9WxBUFU4.&quot;"><id>tag:blogger.com,1999:blog-2831407981489723026.post-7541997823022218149</id><published>2010-03-02T13:03:00.003Z</published><updated>2010-03-02T13:09:28.277Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-02T13:09:28.277Z</app:edited><title>Nebeans: problem when pasring tables from mysq</title><content type="html">A weired thing happened to me today, as I created a new schema using MYSQL Workbench, and then tried to create entities from the database, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;netbeans&lt;/span&gt; complained that for some tables it cannot find the primary key, even it really exists. I googled around and found the solution is when forward engineering using &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;MYSQL&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;Woekbench&lt;/span&gt; you need to check(tick) the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;checbox&lt;/span&gt; for creating separate index statement as in the figure below:&lt;div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_VM2cMFzoDZc/S40Nq9fu5bI/AAAAAAAACZQ/Tfu0dY51WFM/s1600-h/1.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 251px;" src="http://1.bp.blogspot.com/_VM2cMFzoDZc/S40Nq9fu5bI/AAAAAAAACZQ/Tfu0dY51WFM/s400/1.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5444022556274124210" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2831407981489723026-7541997823022218149?l=mountyahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/TQrD3XdOkpS1PwVdd92TNPIS6ww/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/TQrD3XdOkpS1PwVdd92TNPIS6ww/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/TQrD3XdOkpS1PwVdd92TNPIS6ww/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/TQrD3XdOkpS1PwVdd92TNPIS6ww/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/DqDX/~4/8uj-fo-qlJ8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mountyahmed.blogspot.com/feeds/7541997823022218149/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://mountyahmed.blogspot.com/2010/03/nebeans-problem-when-pasring-tables.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2831407981489723026/posts/default/7541997823022218149?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2831407981489723026/posts/default/7541997823022218149?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/DqDX/~3/8uj-fo-qlJ8/nebeans-problem-when-pasring-tables.html" title="Nebeans: problem when pasring tables from mysq" /><author><name>Monty</name><uri>http://www.blogger.com/profile/06949879134960499798</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_VM2cMFzoDZc/S40Nq9fu5bI/AAAAAAAACZQ/Tfu0dY51WFM/s72-c/1.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://mountyahmed.blogspot.com/2010/03/nebeans-problem-when-pasring-tables.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DE8DSX06cSp7ImA9WxBUE0Q.&quot;"><id>tag:blogger.com,1999:blog-2831407981489723026.post-2546548359322063405</id><published>2010-02-28T22:22:00.006Z</published><updated>2010-02-28T22:41:18.319Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-28T22:41:18.319Z</app:edited><title>Binding a JComboBox to a database query list</title><content type="html">exactly in the same way we bound the JTable, but we encounter one problem, &lt;div&gt;since each entity has more than one field/property, the combobox does not know&lt;/div&gt;&lt;div&gt;which to display so by default it uses the toString() method of each entity, which gives us&lt;/div&gt;&lt;div&gt;something displayed like this:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_VM2cMFzoDZc/S4ruWKjjLFI/AAAAAAAACY4/0bd5A3Zwock/s1600-h/step1.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 242px;" src="http://4.bp.blogspot.com/_VM2cMFzoDZc/S4ruWKjjLFI/AAAAAAAACY4/0bd5A3Zwock/s400/step1.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5443425164188658770" /&gt;&lt;/a&gt;To change the display behaviour we need to customise the renderer of the Combobox&lt;div&gt;to render the required property of the entity as:&lt;/div&gt;&lt;div&gt;by getting the combo box propety we add code in the pre-init section as follows:&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_VM2cMFzoDZc/S4rvYw27ZnI/AAAAAAAACZA/Xh7aKgfAIME/s1600-h/step2.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 318px; height: 400px;" src="http://3.bp.blogspot.com/_VM2cMFzoDZc/S4rvYw27ZnI/AAAAAAAACZA/Xh7aKgfAIME/s400/step2.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5443426308341851762" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;so we insert the following code:&lt;/div&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[     &lt;br /&gt;jComboBox3.setRenderer(new DefaultListCellRenderer() {&lt;br /&gt;           @Override&lt;br /&gt;           public Component getListCellRendererComponent(&lt;br /&gt;                   JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {&lt;br /&gt;               super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);&lt;br /&gt;               if (value instanceof Category) {&lt;br /&gt;                   Category c = (Category)value;&lt;br /&gt;                   setText(c.getType());&lt;br /&gt;               }&lt;br /&gt;               return this;&lt;br /&gt;           }&lt;br /&gt;       });&lt;br /&gt;&lt;br /&gt; ]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_VM2cMFzoDZc/S4rwEx4mt3I/AAAAAAAACZI/j6LTNqa_yyI/s1600-h/step3.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 164px;" src="http://2.bp.blogspot.com/_VM2cMFzoDZc/S4rwEx4mt3I/AAAAAAAACZI/j6LTNqa_yyI/s400/step3.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5443427064531564402" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2831407981489723026-2546548359322063405?l=mountyahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/SH8FvNEgbNp_CLpaIbk-s3iEcbA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/SH8FvNEgbNp_CLpaIbk-s3iEcbA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/SH8FvNEgbNp_CLpaIbk-s3iEcbA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/SH8FvNEgbNp_CLpaIbk-s3iEcbA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/DqDX/~4/E_HcauoR60I" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mountyahmed.blogspot.com/feeds/2546548359322063405/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://mountyahmed.blogspot.com/2010/02/binding-jcombobox-to-database-query.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2831407981489723026/posts/default/2546548359322063405?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2831407981489723026/posts/default/2546548359322063405?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/DqDX/~3/E_HcauoR60I/binding-jcombobox-to-database-query.html" title="Binding a JComboBox to a database query list" /><author><name>Monty</name><uri>http://www.blogger.com/profile/06949879134960499798</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_VM2cMFzoDZc/S4ruWKjjLFI/AAAAAAAACY4/0bd5A3Zwock/s72-c/step1.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://mountyahmed.blogspot.com/2010/02/binding-jcombobox-to-database-query.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0EFQH4ycSp7ImA9WxBUEU4.&quot;"><id>tag:blogger.com,1999:blog-2831407981489723026.post-5702146448691457189</id><published>2010-02-25T22:59:00.005Z</published><updated>2010-02-25T23:13:31.099Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-25T23:13:31.099Z</app:edited><title>Netbeans: Binding JTable to a database table</title><content type="html">To bind a JTable to a database table, you right click on the table&lt;br /&gt;and select bind-&gt; elements&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 256px;" src="http://3.bp.blogspot.com/_VM2cMFzoDZc/S4cCYFfBt3I/AAAAAAAACYg/-pSYEU67AME/s400/Step1.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5442321287512962930" /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;then select import from Database and Netbeans will take care of creating EntityManager, a Query and a List with the result of the query.&lt;div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_VM2cMFzoDZc/S4cD2OqK6nI/AAAAAAAACYw/GWoS6O08r-I/s1600-h/step2.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 387px;" src="http://4.bp.blogspot.com/_VM2cMFzoDZc/S4cD2OqK6nI/AAAAAAAACYw/GWoS6O08r-I/s400/step2.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5442322904883325554" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;The list is by default normal java.util.List so when it is modified the JTable which is bound to it does not get updated. To update it we need to set the List as Observale by right clicking on the list in the design view of netbeans and ticking the observable check box.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_VM2cMFzoDZc/S4cDhWvxNRI/AAAAAAAACYo/UpMK85dmQ1U/s1600-h/step3.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 364px; height: 400px;" src="http://4.bp.blogspot.com/_VM2cMFzoDZc/S4cDhWvxNRI/AAAAAAAACYo/UpMK85dmQ1U/s400/step3.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5442322546277037330" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2831407981489723026-5702146448691457189?l=mountyahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Ll7KVfEj52mRv2HAz91FnNbQOIU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Ll7KVfEj52mRv2HAz91FnNbQOIU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Ll7KVfEj52mRv2HAz91FnNbQOIU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Ll7KVfEj52mRv2HAz91FnNbQOIU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/DqDX/~4/pv7rKNUZVyo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mountyahmed.blogspot.com/feeds/5702146448691457189/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://mountyahmed.blogspot.com/2010/02/netbeans-binding-jtable-to-database.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2831407981489723026/posts/default/5702146448691457189?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2831407981489723026/posts/default/5702146448691457189?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/DqDX/~3/pv7rKNUZVyo/netbeans-binding-jtable-to-database.html" title="Netbeans: Binding JTable to a database table" /><author><name>Monty</name><uri>http://www.blogger.com/profile/06949879134960499798</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_VM2cMFzoDZc/S4cCYFfBt3I/AAAAAAAACYg/-pSYEU67AME/s72-c/Step1.jpg" height="72" width="72" /><thr:total>3</thr:total><feedburner:origLink>http://mountyahmed.blogspot.com/2010/02/netbeans-binding-jtable-to-database.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkIGRXY9fCp7ImA9WxBVF0s.&quot;"><id>tag:blogger.com,1999:blog-2831407981489723026.post-1994658579036613079</id><published>2010-02-20T23:11:00.004Z</published><updated>2010-02-21T13:55:24.864Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-21T13:55:24.864Z</app:edited><title>Updated Persistance Layer of the application Labels</title><content type="html">&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_VM2cMFzoDZc/S4E7LGKIhYI/AAAAAAAACYY/LWhe4bTfzvo/s1600-h/UpdatedLabelsModel.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 400px; height: 307px;" src="http://4.bp.blogspot.com/_VM2cMFzoDZc/S4E7LGKIhYI/AAAAAAAACYY/LWhe4bTfzvo/s400/UpdatedLabelsModel.jpg" alt="" id="BLOGGER_PHOTO_ID_5440694886657983874" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;span style="font-family:lucida grande;"&gt;Finaly got to finalize the design of the persistence layer with the required business constraints such as:&lt;/span&gt; &lt;span style="font-family:lucida grande;"&gt;Table &lt;span style="color: rgb(51, 51, 255);"&gt;item&lt;/span&gt;: the combination of the columns-&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;name, packaging_packaging_id,category_category_id&lt;/span&gt; remains unique as we don't want to have&lt;/span&gt; &lt;span style="font-family:lucida grande;"&gt;an item with a size,name, category repeated more than once. so I have created an index called &lt;span style="color: rgb(51, 102, 255);"&gt;item_index&lt;/span&gt; to establish this purpose&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2831407981489723026-1994658579036613079?l=mountyahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/R5ufpnVJhUbKaxkxvDGAaEiPyu8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/R5ufpnVJhUbKaxkxvDGAaEiPyu8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/R5ufpnVJhUbKaxkxvDGAaEiPyu8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/R5ufpnVJhUbKaxkxvDGAaEiPyu8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/DqDX/~4/BWwhj03fpQA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mountyahmed.blogspot.com/feeds/1994658579036613079/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://mountyahmed.blogspot.com/2010/02/updated-persistance-layer-of.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2831407981489723026/posts/default/1994658579036613079?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2831407981489723026/posts/default/1994658579036613079?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/DqDX/~3/BWwhj03fpQA/updated-persistance-layer-of.html" title="Updated Persistance Layer of the application Labels" /><author><name>Monty</name><uri>http://www.blogger.com/profile/06949879134960499798</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_VM2cMFzoDZc/S4E7LGKIhYI/AAAAAAAACYY/LWhe4bTfzvo/s72-c/UpdatedLabelsModel.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://mountyahmed.blogspot.com/2010/02/updated-persistance-layer-of.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU8ESHg7eCp7ImA9WxBVFkw.&quot;"><id>tag:blogger.com,1999:blog-2831407981489723026.post-236147222663983689</id><published>2010-02-19T22:13:00.002Z</published><updated>2010-02-19T22:16:49.600Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-19T22:16:49.600Z</app:edited><title>Use of Generics to create a generic interface with common methods, for each class will have a different type</title><content type="html">&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_VM2cMFzoDZc/S38NwMgtRyI/AAAAAAAACYI/YwAve5oBzkc/s1600-h/generics.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 384px; height: 193px;" src="http://3.bp.blogspot.com/_VM2cMFzoDZc/S38NwMgtRyI/AAAAAAAACYI/YwAve5oBzkc/s400/generics.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5440081996530140962" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2831407981489723026-236147222663983689?l=mountyahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/pwo8bmjKH6l0KeBMS5MbTfV7Hsc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/pwo8bmjKH6l0KeBMS5MbTfV7Hsc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/pwo8bmjKH6l0KeBMS5MbTfV7Hsc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/pwo8bmjKH6l0KeBMS5MbTfV7Hsc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/DqDX/~4/TxR6wiB_MEc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mountyahmed.blogspot.com/feeds/236147222663983689/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://mountyahmed.blogspot.com/2010/02/use-of-generics-to-create-generic.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2831407981489723026/posts/default/236147222663983689?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2831407981489723026/posts/default/236147222663983689?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/DqDX/~3/TxR6wiB_MEc/use-of-generics-to-create-generic.html" title="Use of Generics to create a generic interface with common methods, for each class will have a different type" /><author><name>Monty</name><uri>http://www.blogger.com/profile/06949879134960499798</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_VM2cMFzoDZc/S38NwMgtRyI/AAAAAAAACYI/YwAve5oBzkc/s72-c/generics.jpg" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://mountyahmed.blogspot.com/2010/02/use-of-generics-to-create-generic.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkAHRHcyeCp7ImA9WxBVF0o.&quot;"><id>tag:blogger.com,1999:blog-2831407981489723026.post-5629649478886484215</id><published>2010-02-18T01:42:00.007Z</published><updated>2010-02-21T18:58:55.990Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-21T18:58:55.990Z</app:edited><title>Create a unique combination of columns in a table</title><content type="html">&lt;script type="syntaxhighlighter" class="brush: sql"&gt;&lt;![CDATA[&lt;br /&gt;    upindex on item(name,packaging_packaging_id,category_category_id);&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;where upindex is the index name,&lt;br /&gt;item is the table name is the columns are: name,packaging_packaging_id,category_category_id&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2831407981489723026-5629649478886484215?l=mountyahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/39g7JFrBvlSqJrynVgzUo-7YCSU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/39g7JFrBvlSqJrynVgzUo-7YCSU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/39g7JFrBvlSqJrynVgzUo-7YCSU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/39g7JFrBvlSqJrynVgzUo-7YCSU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/DqDX/~4/Nhd7nCmr4Ew" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mountyahmed.blogspot.com/feeds/5629649478886484215/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://mountyahmed.blogspot.com/2010/02/create-unique-combination-of-columns-in.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2831407981489723026/posts/default/5629649478886484215?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2831407981489723026/posts/default/5629649478886484215?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/DqDX/~3/Nhd7nCmr4Ew/create-unique-combination-of-columns-in.html" title="Create a unique combination of columns in a table" /><author><name>Monty</name><uri>http://www.blogger.com/profile/06949879134960499798</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mountyahmed.blogspot.com/2010/02/create-unique-combination-of-columns-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak8MRnc9eSp7ImA9WxBVF0o.&quot;"><id>tag:blogger.com,1999:blog-2831407981489723026.post-2494378039088089190</id><published>2010-02-13T02:06:00.004Z</published><updated>2010-02-21T19:01:27.961Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-21T19:01:27.961Z</app:edited><title>Reset of auto_increment in mysql</title><content type="html">&lt;script type="syntaxhighlighter" class="brush: sql"&gt;&lt;![CDATA[&lt;br /&gt;    alter table  packaging auto_increment 1;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;means next primary key will have the value 1&lt;br /&gt;when using entity manager with transactions, even when you roll back the auto_increment valueproceeds so the next row will have a primary key with +1 even if it was rolled back!!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2831407981489723026-2494378039088089190?l=mountyahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/nXgSQ5o35Rh05P3SLy-k3CzHRvI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nXgSQ5o35Rh05P3SLy-k3CzHRvI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/nXgSQ5o35Rh05P3SLy-k3CzHRvI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nXgSQ5o35Rh05P3SLy-k3CzHRvI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/DqDX/~4/HymbOWX3s_s" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mountyahmed.blogspot.com/feeds/2494378039088089190/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://mountyahmed.blogspot.com/2010/02/reset-of-autoincrement-in-mysql.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2831407981489723026/posts/default/2494378039088089190?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2831407981489723026/posts/default/2494378039088089190?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/DqDX/~3/HymbOWX3s_s/reset-of-autoincrement-in-mysql.html" title="Reset of auto_increment in mysql" /><author><name>Monty</name><uri>http://www.blogger.com/profile/06949879134960499798</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mountyahmed.blogspot.com/2010/02/reset-of-autoincrement-in-mysql.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0QHQHs5fCp7ImA9WxBVF0o.&quot;"><id>tag:blogger.com,1999:blog-2831407981489723026.post-8412330310416622587</id><published>2010-02-12T23:07:00.008Z</published><updated>2010-02-21T19:08:51.524Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-21T19:08:51.524Z</app:edited><title>Creating OneToMany Uniderictional Relationship Example</title><content type="html">Lets take an example of the following Entities: Item, Ingredients&lt;br /&gt;Item contains many ingredients so the relatioship between them is OneToMany.&lt;br /&gt;&lt;br /&gt;Creating the Tables&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: sql"&gt;&lt;![CDATA[&lt;br /&gt;create table item(&lt;br /&gt;item_id integer not null primary key auto_increment,&lt;br /&gt;name varchar(30) not null)&lt;br /&gt;engine=InnoDB;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Creating the Tables&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: sql"&gt;&lt;![CDATA[&lt;br /&gt;create table ingredients(&lt;br /&gt;ing_id integer not null primary key auto_increment,&lt;br /&gt;product varchar(30) not null,&lt;br /&gt;item_id_fk integer not null,&lt;br /&gt;foreign key(item_id_fk) references item(item_id))&lt;br /&gt;engine=InnoDB;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The presence of the foreign key in the target table is indicating a one to many relatioship&lt;br /&gt;&lt;br /&gt;now we need to map it in the two entity classes&lt;br /&gt;in the item class&lt;br /&gt;we create a List as follows:&lt;br /&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;@OneToMany(cascade=CascadeType.PERSIST)&lt;br /&gt;@JoinColumn(name="item_id_fk")&lt;br /&gt;private List ingredients;&lt;br /&gt;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;and in the ingredient class we create an attribite corresponding&lt;br /&gt;to the column of the foreign key as:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;@Column(name="item_id_fk")&lt;br /&gt;private int item_id_fk;&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now when we persists an Item object, automatically the item's primary key is created by the database as from 1 increments&lt;br /&gt;then to map the ingredients to this entity(add them to this entity&lt;br /&gt;we have to follow these steps&lt;br /&gt;1- Retrieve the entity object from the database using&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;Item item = em.find(Item.class,1);&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;or using JPQL&lt;br /&gt;2 - then creating the new ingredients entities&lt;br /&gt;1- Retrieve the entity object from the database using&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;Ingredient ing = new Ingredient();&lt;br /&gt;ing.setProduct("Cucomber")&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3 - then setting the relationship by setting the foreign key value as&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;ing.setItemIdFK(item.getItemId());&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;and then calling a merge on item as&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;br /&gt;em.merge(item);&lt;br /&gt;]]&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;to update the item&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2831407981489723026-8412330310416622587?l=mountyahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/PesWa8y4UB6eaOgbmQhtaDpKxRo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PesWa8y4UB6eaOgbmQhtaDpKxRo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/PesWa8y4UB6eaOgbmQhtaDpKxRo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PesWa8y4UB6eaOgbmQhtaDpKxRo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/DqDX/~4/xRFcMnIia48" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mountyahmed.blogspot.com/feeds/8412330310416622587/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://mountyahmed.blogspot.com/2010/02/creating-onetomany-uniderictional.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2831407981489723026/posts/default/8412330310416622587?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2831407981489723026/posts/default/8412330310416622587?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/DqDX/~3/xRFcMnIia48/creating-onetomany-uniderictional.html" title="Creating OneToMany Uniderictional Relationship Example" /><author><name>Monty</name><uri>http://www.blogger.com/profile/06949879134960499798</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://mountyahmed.blogspot.com/2010/02/creating-onetomany-uniderictional.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A08DSHs8cCp7ImA9WxBWFUU.&quot;"><id>tag:blogger.com,1999:blog-2831407981489723026.post-8866991375812552046</id><published>2010-02-08T00:42:00.001Z</published><updated>2010-02-08T00:44:39.578Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-08T00:44:39.578Z</app:edited><title>GWT and JPA don't get along</title><content type="html">After doing a little research, for my work project Labels I discovered that I will have difficulties using JPA with GWT so I diceded to use Vaadin framework to create the presentation layer.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2831407981489723026-8866991375812552046?l=mountyahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/35-qx7B0LSIPfA-2LSRPc0MTlNE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/35-qx7B0LSIPfA-2LSRPc0MTlNE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/35-qx7B0LSIPfA-2LSRPc0MTlNE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/35-qx7B0LSIPfA-2LSRPc0MTlNE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/DqDX/~4/HkjaJQtvTTM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mountyahmed.blogspot.com/feeds/8866991375812552046/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://mountyahmed.blogspot.com/2010/02/gwt-and-jpa-dont-get-along.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2831407981489723026/posts/default/8866991375812552046?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2831407981489723026/posts/default/8866991375812552046?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/DqDX/~3/HkjaJQtvTTM/gwt-and-jpa-dont-get-along.html" title="GWT and JPA don't get along" /><author><name>Monty</name><uri>http://www.blogger.com/profile/06949879134960499798</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://mountyahmed.blogspot.com/2010/02/gwt-and-jpa-dont-get-along.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0AFSXgzcSp7ImA9WxBWFUU.&quot;"><id>tag:blogger.com,1999:blog-2831407981489723026.post-1284102556289982816</id><published>2009-12-31T23:49:00.008Z</published><updated>2010-02-08T00:41:58.689Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-08T00:41:58.689Z</app:edited><title>Creating My First Java EE Aplication</title><content type="html">Finally got time to fix the database at work that I have created(quickly) and inefficiently. The current database consists of 5 tables of identical structure, they all hold the same items but each table is for a different category.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_VM2cMFzoDZc/S0ErtqmkeeI/AAAAAAAACWI/5c7zo8E2BUw/s1600-h/current+model.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 214px; height: 211px;" src="http://2.bp.blogspot.com/_VM2cMFzoDZc/S0ErtqmkeeI/AAAAAAAACWI/5c7zo8E2BUw/s320/current+model.png" alt="" id="BLOGGER_PHOTO_ID_5422663489860958690" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;This model is not good for many reasons, one is creating an item which already exists but with different size/packaging means duplicating the same information in a new row with the name change to accommodate the size. This is a text book redundancy of data, now i can use this bad model to create a more and better database structure and build on top of it a Java EE application using Java Persistance and EJB.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;The Database Design phase:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;After elaboration in which tables should fit the attributes of the original big table I came up with the following design.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_VM2cMFzoDZc/S29dZJFsFtI/AAAAAAAACXk/cxSDuKZpbbc/s1600-h/Databse+Design+Updated.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 211px;" src="http://2.bp.blogspot.com/_VM2cMFzoDZc/S29dZJFsFtI/AAAAAAAACXk/cxSDuKZpbbc/s400/Databse+Design+Updated.png" alt="" id="BLOGGER_PHOTO_ID_5435665961777370834" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;So from the diagram we can see that the item name is used as a primary key in combination with the packaging which means that an item y with packaging x can only exists only once which we want to achive.&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;- &lt;/span&gt;scan_id&lt;/span&gt; can be null which will allow us to create item with no bar code&lt;br /&gt;- &lt;span style="color: rgb(255, 0, 0);"&gt;cat_id&lt;/span&gt; cannot be null which will not allow us to create item without a category&lt;br /&gt;- &lt;span style="color: rgb(255, 0, 0);"&gt;cok_id&lt;/span&gt; can be null, which will allow us to create item with no cooking instructions&lt;br /&gt;- &lt;span style="color: rgb(255, 0, 0);"&gt;expiry&lt;/span&gt; field/column can be default 0, to enable us later to set the expiry duration for the items by the labelling software&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Designing JPA Enities&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_VM2cMFzoDZc/S0aE0Jom05I/AAAAAAAACXA/GR1LAnY7Ivg/s1600-h/graph_img.jpeg"&gt;&lt;img style="cursor: pointer; width: 400px; height: 286px;" src="http://3.bp.blogspot.com/_VM2cMFzoDZc/S0aE0Jom05I/AAAAAAAACXA/GR1LAnY7Ivg/s400/graph_img.jpeg" alt="" id="BLOGGER_PHOTO_ID_5424168832688640914" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2831407981489723026-1284102556289982816?l=mountyahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/wiKOSYJ3a078Cby9BSCjfwG6mxo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wiKOSYJ3a078Cby9BSCjfwG6mxo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/wiKOSYJ3a078Cby9BSCjfwG6mxo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wiKOSYJ3a078Cby9BSCjfwG6mxo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/DqDX/~4/ju7LtXf9oiE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://mountyahmed.blogspot.com/feeds/1284102556289982816/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://mountyahmed.blogspot.com/2009/12/label-database-layout.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2831407981489723026/posts/default/1284102556289982816?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2831407981489723026/posts/default/1284102556289982816?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/DqDX/~3/ju7LtXf9oiE/label-database-layout.html" title="Creating My First Java EE Aplication" /><author><name>Monty</name><uri>http://www.blogger.com/profile/06949879134960499798</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_VM2cMFzoDZc/S0ErtqmkeeI/AAAAAAAACWI/5c7zo8E2BUw/s72-c/current+model.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://mountyahmed.blogspot.com/2009/12/label-database-layout.html</feedburner:origLink></entry></feed>

