0
當然這一次似乎每Here很容易,但我增加了以下我的應用程序上下文...PostgreSQL的錯誤與Spring MVC /休眠工作
「大對象可能無法在自動提交模式下使用」<property name="dataSource">
<ref bean="dataSource"/>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.autocommit">false</prop>
</props>
</property>
<property name="annotatedClasses">
<list>
<value>com.gleason.gt.server.model.database.PlayListEntry</value>
<value>com.gleason.gt.server.model.database.MusicFile</value>
</list>
</property>
</bean>
我仍然得到同樣的錯誤,有什麼想法嗎?
UPDATE 添加服務/ DAO
@Repository("musicFileDao")
public class MusicFileDAOImpl extends GroovyTimeHibernateDAOSupport{
@Transactional()
public MusicFile getMusicFile(Integer i){
@SuppressWarnings("unchecked")
List<MusicFile> returnValue = (List<MusicFile>)getHibernateTemplate().find("from MusicFile where id=?",i);
if(returnValue.size()>0){
return returnValue.get(0);
}
return null;
}
}
@Service("musicFileService")
public class MusicFileService {
@Autowired
private MusicFileDAOImpl dao;
@Transactional
public MusicFile getMusicFile(Integer i){
return dao.getMusicFile(i);
}
}
@Lob
@Column(name="file")
private byte[] file;
與我在其他問題上的評論相同:我確定您不需要LargeObjects,而是使用bytea。 –
請查閱[大型對象]手冊(http://www.postgresql.org/docs/9.1/interactive/largeobjects.html)。他們與其他任何東西都不一樣。 –
感謝您的評論我想我可以使用LargeObject的字節數組?我試圖看看這個鏈接,但有點在我頭上。在其他消息中,我嘗試將其隔離。我拿出OneToOne映射並直接訪問。我仍然得到錯誤,我試圖使它成爲事務性的,等等。所以我應該通過鏈接來研究和承擔它嗎? – Jackie