已采納回答 / uestc_chen
你用的是Hibernate5.0及以上版本,不需要ServiceRegistry了,視頻老師用的是4.X版本的Hibernate。將代碼改為下面的就可以了@Before?? ?public void init()?? ?{?? ??? ?/*?? ??? ? * hibernate 5.0以上版本,不通過ServiceRegistry?? ??? ? */?? ??? ?//創建配置對象?? ??? ?Configuration configuration=new Configuration().conf...
2016-12-09
最新回答 / Airly
import org.hibernate.Session;import org.hibernate.SessionFactory;import org.hibernate.Transaction;import org.hibernate.cfg.Configuration;import org.hibernate.jdbc.Work;import org.hibernate.service.ServiceRegistry;import org.hibernate.service.ServiceRegist...
2016-12-05
已采納回答 / Airly
你不要太擔心這個問題。只要后面沒有報錯就行了。以后工作中是不會把圖片存到數據庫中的,一般都是存一個路徑就行了。而且一般來說圖片就是用二進制的方式存入到數據庫中。這里用的FileInputStream字節流,我覺得可能是序列化或者反序列化的一些問題,是程序內部自己處理的方式的問題。我覺得不用太糾結,這個例子主要告訴你Blob的運用。你主要掌握:<property name="picture" type="java.sql.Blob">? ? ? ? <column name="PICT...
2016-12-04