JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Software Engineering » OOAD  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 物件資料Insert到資料庫的Method應該寫在哪裡?
beliefchen





發文: 36
積分: 0
於 2009-04-12 22:24 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
假如說一個物件,例如員工物件
當我新增了一個員工物件,屬性也設定好了
要Insert到資料庫時,這個Add() 的Method應該寫在哪裡比較好
寫在員工的Class裡頭嗎?應該不是
還是要產生另一個Class 來管員工物件的Insert資料庫


reply to postreply to post
作者 Re:物件資料Insert到資料庫的Method應該寫在哪裡? [Re:beliefchen]
parkghost





發文: 253
積分: 0
於 2009-04-12 23:04 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
你可以參考DAO的架構.
http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html


reply to postreply to post
~流浪啊
作者 Re:物件資料Insert到資料庫的Method應該寫在哪裡? [Re:beliefchen]
beliefchen





發文: 36
積分: 0
於 2009-04-13 09:28 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
沒想到這問題那麼複雜

reply to postreply to post
作者 Re:物件資料Insert到資料庫的Method應該寫在哪裡? [Re:beliefchen]
akin





發文: 24
積分: 0
於 2009-10-12 16:59 user profilesend a private message to usersend email to akinreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
不用想的那麼複雜

你想寫在那就寫在那, 易於維護,最重要

套用了一堆樣式, 如果不易於維護, 也是枉然

"如果你的員工class是 entity 我就會把 add 加在員工這理"


reply to postreply to post
作者 Re:物件資料Insert到資料庫的Method應該寫在哪裡? [Re:beliefchen]
andyjjt





發文: 6
積分: 0
於 2009-10-12 23:08 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
您如果有興趣當然也可看看 JPA的 framework , 透過Entity Manager幫您管理這些對entity增查刪改的session , 或到我的網站 http://UMLThinking.idv.tw 找一篇循序圖 ->Sequence JSF前端到JPA 後端的循序圖 , 提供給您參考 .

Best regurds ,
Andy(OCUP Advanced)
http://UMLThinking.idv.tw


reply to postreply to post
作者 Re:物件資料Insert到資料庫的Method應該寫在哪裡? [Re:andyjjt]
starlin





發文: 14
積分: 0
於 2011-06-12 17:23 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
It depends :

1) Use DAO with Direct JDBC.

2) Use Model Facade with JPA or OR Mapping

3) Use Session Bean with EJB3


reply to postreply to post
» JWorld@TW »  Software Engineering » OOAD

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8