本文整理了Java中org.hibernate.Query.isReadOnly
方法的一些代码示例,展示了Query.isReadOnly
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.isReadOnly
方法的具体详情如下:
包路径:org.hibernate.Query
类名称:Query
方法名:isReadOnly
[英]Should entities and proxies loaded by this Query be put in read-only mode? If the read-only/modifiable setting was not initialized, then the default read-only/modifiable setting for the persistence context is returned instead.
[中]此查询加载的实体和代理是否应置于只读模式?如果只读/可修改设置未初始化,则返回持久性上下文的默认只读/可修改设置。
代码示例来源:origin: hibernate/hibernate-orm
int i = 0;
Query query = s.createQuery("from DataPoint dp order by dp.x asc");
assertTrue( query.isReadOnly() );
s.setDefaultReadOnly( false );
assertFalse( query.isReadOnly() );
s.setDefaultReadOnly( true );
assertTrue( query.isReadOnly() );
query.setReadOnly( false );
assertFalse( query.isReadOnly() );
s.setDefaultReadOnly( false );
assertFalse( query.isReadOnly() );
s.setDefaultReadOnly( true );
assertFalse( query.isReadOnly() );
query.setReadOnly( true );
assertTrue( query.isReadOnly() );
s.setDefaultReadOnly( false );
assertTrue( query.isReadOnly() );
query.setReadOnly( false );
assertFalse( query.isReadOnly() );
s.setDefaultReadOnly( true );
assertTrue( s.isDefaultReadOnly() );
Iterator it = query.iterate();
assertFalse( query.isReadOnly() );
DataPoint dpLast = ( DataPoint ) s.get( DataPoint.class, dp.getId() );
assertTrue( s.isReadOnly( dpLast ) );
query.setReadOnly( true );
assertTrue( query.isReadOnly() );
int nExpectedChanges = 0;
assertTrue( s.isDefaultReadOnly() );
代码示例来源:origin: hibernate/hibernate-orm
int i = 0;
Query query = s.createQuery("from DataPoint dp order by dp.x asc");
assertFalse( query.isReadOnly() );
s.setDefaultReadOnly( true );
assertTrue( query.isReadOnly() );
s.setDefaultReadOnly( false );
assertFalse( query.isReadOnly() );
query.setReadOnly( true );
assertTrue( query.isReadOnly() );
s.setDefaultReadOnly( true );
assertTrue( query.isReadOnly() );
s.setDefaultReadOnly( false );
assertTrue( query.isReadOnly() );
query.setReadOnly( false );
assertFalse( query.isReadOnly() );
s.setDefaultReadOnly( true );
assertFalse( query.isReadOnly() );
query.setReadOnly( true );
assertTrue( query.isReadOnly() );
s.setDefaultReadOnly( false );
assertFalse( s.isDefaultReadOnly() );
Iterator it = query.iterate();
assertTrue( query.isReadOnly() );
DataPoint dpLast = ( DataPoint ) s.get( DataPoint.class, dp.getId() );
assertFalse( s.isReadOnly( dpLast ) );
query.setReadOnly( false );
assertFalse( query.isReadOnly() );
int nExpectedChanges = 0;
assertFalse( s.isDefaultReadOnly() );
代码示例来源:origin: hibernate/hibernate-orm
int i = 0;
Query query = s.createQuery("from DataPoint dp order by dp.x asc");
assertTrue( query.isReadOnly() );
s.setDefaultReadOnly( false );
assertFalse( query.isReadOnly() );
s.setDefaultReadOnly( true );
assertTrue( query.isReadOnly() );
query.setReadOnly( false );
assertFalse( query.isReadOnly() );
s.setDefaultReadOnly( false );
assertFalse( query.isReadOnly() );
s.setDefaultReadOnly( true );
assertFalse( query.isReadOnly() );
query.setReadOnly( true );
assertTrue( query.isReadOnly() );
s.setDefaultReadOnly( false );
assertTrue( query.isReadOnly() );
query.setReadOnly( false );
assertFalse( query.isReadOnly() );
s.setDefaultReadOnly( true );
assertTrue( s.isDefaultReadOnly() );
ScrollableResults sr = query.scroll(ScrollMode.FORWARD_ONLY);
assertFalse( query.isReadOnly() );
DataPoint dpLast = ( DataPoint ) s.get( DataPoint.class, dp.getId() );
assertTrue( s.isReadOnly( dpLast ) );
query.setReadOnly( true );
assertTrue( query.isReadOnly() );
int nExpectedChanges = 0;
assertTrue( s.isDefaultReadOnly() );
代码示例来源:origin: hibernate/hibernate-orm
int i = 0;
Query query = s.createQuery("from DataPoint dp order by dp.x asc");
assertFalse( query.isReadOnly() );
s.setDefaultReadOnly( true );
assertTrue( query.isReadOnly() );
s.setDefaultReadOnly( false );
assertFalse( query.isReadOnly() );
query.setReadOnly( true );
assertTrue( query.isReadOnly() );
s.setDefaultReadOnly( true );
assertTrue( query.isReadOnly() );
s.setDefaultReadOnly( false );
assertTrue( query.isReadOnly() );
query.setReadOnly( false );
assertFalse( query.isReadOnly() );
s.setDefaultReadOnly( true );
assertFalse( query.isReadOnly() );
query.setReadOnly( true );
assertTrue( query.isReadOnly() );
s.setDefaultReadOnly( false );
assertFalse( s.isDefaultReadOnly() );
ScrollableResults sr = query.scroll(ScrollMode.FORWARD_ONLY);
assertFalse( s.isDefaultReadOnly() );
assertTrue( query.isReadOnly() );
DataPoint dpLast = ( DataPoint ) s.get( DataPoint.class, dp.getId() );
assertFalse( s.isReadOnly( dpLast ) );
query.setReadOnly( false );
assertFalse( query.isReadOnly() );
int nExpectedChanges = 0;
代码示例来源:origin: com.github.cafdataprocessing/corepolicy-hibernate
@Override
public boolean isReadOnly() {
return query.isReadOnly();
}
代码示例来源:origin: ezbz/projectx
@Override
public boolean isReadOnly() {
return query.isReadOnly();
}
代码示例来源:origin: riotfamily/riot
public boolean isReadOnly() {
return query.isReadOnly();
}
代码示例来源:origin: bonitasoft/bonita-engine
private static <T> void disconnectIfReadOnly(List<T> list, Query query, Session session) {
if (query.isReadOnly()) {
for (T t : list) {
disconnectEntityFromSession(session, t);
}
}
}
代码示例来源:origin: bonitasoft/bonita-engine
private static <T> T disconnectIfReadOnly(T object, Query query, Session session) {
if (query.isReadOnly()) {
disconnectEntityFromSession(session, object);
}
return object;
}
代码示例来源:origin: bonitasoft/bonita-engine
private static <T> void disconnectIfReadOnly(List<T> list, Query query, Session session) {
if (query.isReadOnly()) {
for (T t : list) {
disconnectEntityFromSession(session, t);
}
}
}
代码示例来源:origin: bonitasoft/bonita-engine
private static <T> T disconnectIfReadOnly(T object, Query query, Session session) {
if (query.isReadOnly()) {
disconnectEntityFromSession(session, object);
}
return object;
}
内容来源于网络,如有侵权,请联系作者删除!