⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 persistent-classes.html

📁 hibernate的一点学习资料!
💻 HTML
📖 第 1 页 / 共 2 页
字号:
                    </p><p>            &#35831;&#27880;&#24847;<tt class="literal">onUpdate()</tt>&#24182;&#19981;&#26159;&#22312;&#27599;&#27425;&#23545;&#35937;&#30340;&#25345;&#20037;&#21270;&#29366;&#24577;&#34987;&#26356;&#26032;&#30340;&#26102;&#20505;&#23601;&#34987;&#35843;&#29992;&#30340;&#12290;&#23427;&#21482;&#22312;&#22788;&#20110;&#23578;&#26410;&#34987;&#25345;&#20037;&#21270;&#30340;&#23545;&#35937;&#34987;&#20256;&#36882;&#32473;<tt class="literal">Session.update()</tt>&#30340;&#26102;&#20505;&#25165;&#20250;&#34987;&#35843;&#29992;&#12290;        </p><p>           	&#22914;&#26524;<tt class="literal">onSave()</tt>, <tt class="literal">onUpdate()</tt> &#25110;&#32773;  <tt class="literal">onDelete()</tt>&#36820;&#22238;<tt class="literal">true</tt>&#65292;&#37027;&#20040;&#25805;&#20316;&#23601;&#34987;&#24708;&#24708;&#22320;&#21462;&#28040;&#20102;&#12290;&#22914;&#26524;&#20854;&#20013;&#25243;&#20986;&#20102;<tt class="literal">CallbackException</tt>&#24322;&#24120;&#65292;&#25805;&#20316;&#34987;&#21462;&#28040;&#65292;&#36825;&#20010;&#24322;&#24120;&#20250;&#34987;&#32487;&#32493;&#20256;&#36882;&#32473;&#24212;&#29992;&#31243;&#24207;&#12290;        </p><p>            &#35831;&#27880;&#24847;<tt class="literal">onSave()</tt>&#26159;&#22312;&#26631;&#35782;&#31526;&#24050;&#32463;&#34987;&#36171;&#20104;&#23545;&#35937;&#21518;&#35843;&#29992;&#30340;&#65292;&#38500;&#38750;&#26159;&#20351;&#29992;&#26412;&#22320;(native)&#26041;&#24335;&#29983;&#25104;&#20851;&#38190;&#23383;&#30340;&#12290;        </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="persistent-classes-s4"></a>4.4.&nbsp;&#21512;&#27861;&#24615;&#26816;&#26597;&#65288;Validatable&#65289;</h2></div></div><div></div></div><p>            &#22914;&#26524;&#25345;&#20037;&#21270;&#31867;&#38656;&#35201;&#22312;&#20445;&#23384;&#20854;&#25345;&#20037;&#21270;&#29366;&#24577;&#21069;&#36827;&#34892;&#21512;&#27861;&#24615;&#26816;&#26597;&#65292;&#23427;&#21487;&#20197;&#23454;&#29616;&#19979;&#38754;&#30340;&#25509;&#21475;&#65306;        </p><pre class="programlisting">public interface Validatable {        public void validate() throws ValidationFailure;}</pre><p>            &#22914;&#26524;&#21457;&#29616;&#23545;&#35937;&#36829;&#21453;&#20102;&#26576;&#26465;&#35268;&#21017;&#65292;&#24212;&#35813;&#25243;&#20986;&#19968;&#20010;<tt class="literal">ValidationFailure</tt>&#24322;&#24120;&#12290;&#22312;<tt class="literal">Validatable</tt>&#23454;&#20363;&#30340;<tt class="literal">validate()</tt>&#26041;&#27861;&#20869;&#37096;&#19981;&#24212;&#35813;&#25913;&#21464;&#23427;&#30340;&#29366;&#24577;&#12290;        </p><p>            &#21644;<tt class="literal">Lifecycle</tt>&#25509;&#21475;&#30340;&#22238;&#35843;&#26041;&#27861;&#19981;&#21516;&#65292;<tt class="literal">validate()</tt>&#21487;&#33021;&#22312;&#20219;&#20309;&#26102;&#38388;&#34987;&#35843;&#29992;&#12290;&#24212;&#29992;&#31243;&#24207;&#19981;&#24212;&#35813;&#25226;<tt class="literal">validate()</tt>&#35843;&#29992;&#21644;&#21830;&#19994;&#21151;&#33021;&#32852;&#31995;&#36215;&#26469;&#12290;        </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="persistent-classes-s5"></a>4.5.&nbsp;XDoclet&#31034;&#20363;</h2></div></div><div></div></div><p>            &#19979;&#19968;&#33410;&#20013;&#25105;&#20204;&#23558;&#20250;&#23637;&#31034;Hibernate&#26144;&#23556;&#26159;&#22914;&#20309;&#29992;&#31616;&#21333;&#30340;&#65292;&#21487;&#38405;&#35835;&#30340;XML&#26684;&#24335;&#34920;&#36798;&#30340;&#12290;&#24456;&#22810;Hibernate&#29992;&#25143;&#21916;&#27426;&#20351;&#29992;XDoclet&#30340;<tt class="literal">@hibernate.tags</tt>&#26631;&#31614;&#30452;&#25509;&#22312;&#28304;&#20195;&#30721;&#20013;&#23884;&#20837;&#26144;&#23556;&#20449;&#24687;&#12290;&#25105;&#20204;&#19981;&#20250;&#22312;&#36825;&#20221;&#25991;&#26723;&#20013;&#35752;&#35770;&#36825;&#20010;&#35805;&#39064;&#65292;&#22240;&#20026;&#20005;&#26684;&#30340;&#26469;&#35828;&#36825;&#23646;&#20110;XDoclet&#30340;&#19968;&#37096;&#20998;&#12290;&#20294;&#25105;&#20204;&#20173;&#28982;&#22312;&#36825;&#37324;&#32473;&#20986;&#19968;&#20221;&#24102;&#26377;XDoclet&#26144;&#23556;&#30340;<tt class="literal">Cat</tt>&#31867;&#30340;&#31034;&#20363;&#12290;        </p><pre class="programlisting">package eg;import java.util.Set;import java.util.Date;/** * @hibernate.class *  table="CATS" */public class Cat {    private Long id; // identifier    private Date birthdate;    private Cat mate;    private Set kittens    private Color color;    private char sex;    private float weight;    /**     * @hibernate.id     *  generator-class="native"     *  column="CAT_ID"     */    public Long getId() {        return id;    }    private void setId(Long id) {        this.id=id;    }    /**     * @hibernate.many-to-one     *  column="MATE_ID"     */    public Cat getMate() {        return mate;    }    void setMate(Cat mate) {        this.mate = mate;    }    /**     * @hibernate.property     *  column="BIRTH_DATE"     */    public Date getBirthdate() {        return birthdate;    }    void setBirthdate(Date date) {        birthdate = date;    }    /**     * @hibernate.property     *  column="WEIGHT"     */    public float getWeight() {        return weight;    }    void setWeight(float weight) {        this.weight = weight;    }    /**     * @hibernate.property     *  column="COLOR"     *  not-null="true"     */    public Color getColor() {        return color;    }    void setColor(Color color) {        this.color = color;    }    /**     * @hibernate.set     *  lazy="true"     *  order-by="BIRTH_DATE"     * @hibernate.collection-key     *  column="PARENT_ID"     * @hibernate.collection-one-to-many     */    public Set getKittens() {        return kittens;    }    void setKittens(Set kittens) {        this.kittens = kittens;    }    // addKitten not needed by Hibernate    public void addKitten(Cat kitten) {        kittens.add(kitten);    }    /**     * @hibernate.property     *  column="SEX"     *  not-null="true"     *  update="false"     */    public char getSex() {        return sex;    }    void setSex(char sex) {        this.sex=sex;    }}</pre></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="session-configuration.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="index.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="or-mapping.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&nbsp;3.&nbsp;SessionFactory&#37197;&#32622;&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Chapter&nbsp;5.&nbsp;O/R Mapping&#22522;&#30784;</td></tr></table></div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -