-
持久化層把程序當中的對象持久化到數據庫當中
通過對象關系映射保存到數據庫的表中
查看全部 -
?JAVA程序員使用面向編程思想來操作數據庫
Hibernate是在JDBC的基礎上進行一定程度的封裝
查看全部 -
寫SQL語句容易出現的問題:
1. 不同的數據庫使用的SQL語法不通。比如:PL/SQL與T/SQL
2. 同樣的功能在不同的數據庫中有不同的實現方式。比如分頁SQL。
3. 程序過分依賴SQL對程序的移植及擴展,維護等帶來很大的麻煩。
查看全部 -
ORM對象/關系映射
查看全部 -
高版本mysql需要明確標識連接是否使用ssl;
且符號&必須改為實體字符&
<property name="connection.url">jdbc:mysql:///hibernate?useUnicode=true&characterEncoding=UTF-8&useSSL=false</property>查看全部 -
hibernate 單表操作實例
查看全部 -
//組件屬性關系映射文件的配置 <component?name="address"?class="Address"> ???<property?name="postname"?column="POSTNAME"></property> ????<property?name="phone"?column="PHONE"></property> ????<property?name="address"?column="ADDRESS"></property> ?</component>
查看全部 -
//寫入blob數據對象 public?void?testWriteBlob(){ ?//new?一個學生對象 ?Student?student=new?Student(1,"張三封","男",new?Date(),"武當山"); ?//得到文件 ?File?file=new?File("d:"+File.separator+"文件名"); ?//獲取照片文件的輸入流 ?InputStream?inputStream=new?FileInputStream(f); ?//創建一個blob對象 ??Blob?image=hibernate.getLobCreator(session).createBlob(input,input.availbale); ??//設置照片屬性 ??student.setPicture(image); ??//保存學生 ??session.save(s); ??session.submit(); }
查看全部 -
public?void?testReadBlob(){ ?//獲取學生對象 ??Student?s=?(Student)Session.get(Student.class,1); ??//獲取Blob對象 ??Blob?image=s.getPicture(); ??//獲取照片的輸入流 ??InputStream?inputstream=image.getBinaryStream(); ??//創建輸出流 ??File?f=new?File("d:"+File.separator+"dest.jpg'); ??OutputStream?outputStream=new?FileOutputStream(f); ??//創建緩沖區 ??byte[]?byte=new?byte[input.available()]; ??input.read(buff); ??output.write(buff); ??input.close(); ??output.close(); ?? }
查看全部 -
?文件分隔符 File.separator
File f=new File("d"+File.separator+"文件名");
//創建一個Blob對象
Blob imgage=Hibernate.getLobCreator(session).createBlob(input,input.availabe())
查看全部 -
hibernate與java對象類型的關系映射
查看全部 -
hibernate與Java基本類型數據類型的映射關系
查看全部 -
session詳解
查看全部 -
使用getCurrentSession需要在配置文件中配置< pro... name='hibernate.current_session_context_class'? >thread<pro...>
查看全部 -
transation簡介
查看全部
舉報