java ee - Difference between database connection through session bean and entity bean -
what difference between writing jdbc (or) hibernate connectivity code in ejb3 session bean , writing same connectivity code through ejb3 entity bean(jpa). please clarify this..
both allow write java gets data in , out of databases, actual coding different.
jdbc lets write sql code
insert ...
or
select ...
you have write own code transfer data between java objects , jdbc code. end lots of repetive "put field in column" kind of code.
have @ examples such link text flavour.
in jpa/hibernate annotate java class instructions tables , columns fields correspond to. reduces amount of code need write.
it's simple example (taken this jpa example:
@entity public class inventory { @id protected long id; ... public void setitem(item item) { this.item = item; this.id = item.getsku(); } ... }
i session bean + jpa considerably less effort session bean + jdbc.
Comments
Post a Comment