本文整理了Java中org.hibernate.HibernateException.getMessage()
方法的一些代码示例,展示了HibernateException.getMessage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HibernateException.getMessage()
方法的具体详情如下:
包路径:org.hibernate.HibernateException
类名称:HibernateException
方法名:getMessage
暂无
代码示例来源:origin: hibernate/hibernate-orm
transaction = session.beginTransaction();
transaction.rollback();
fail(e.getMessage());
} finally {
if (session != null) {
transaction = session.beginTransaction();
transaction.rollback();
fail(e.getMessage());
} finally {
if (session != null) {
transaction = session.beginTransaction();
transaction.rollback();
fail(e.getMessage());
} finally {
if (session != null) {
代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl
protected int executeCountQuery(String query) {
Long count;
try {
count = (Long) getSessionFactory().getCurrentSession().createQuery(query).uniqueResult();
} catch (HibernateException e) {
throw new RuntimeException(e.getMessage(),e);
}
return count.intValue();
}
代码示例来源:origin: phenotips/phenotips
@Override
public void store(AuditEvent event)
{
if (ACTION_IGNORED.contains(event.getAction())) {
return;
}
Session session = this.sessionFactory.getSessionFactory().openSession();
try {
Transaction t = session.beginTransaction();
t.begin();
session.save(event);
t.commit();
} catch (HibernateException ex) {
this.logger.error("Failed to save audit event [{}]: {}", event, ex.getMessage(), ex);
} finally {
session.close();
}
}
代码示例来源:origin: Transitime/core
if (sqlClause != null)
hql += " " + sqlClause;
Query query = session.createQuery(hql);
@SuppressWarnings("unchecked")
List<VehicleEvent> vehicleEvents = query.list();
logger.debug("Getting VehicleEvents from database took {} msec",
timer.elapsedMsec());
return vehicleEvents;
} catch (HibernateException e) {
logger.error(e.getMessage(), e);
return null;
} finally {
代码示例来源:origin: org.ikasan/ikasan-connector-basefiletransfer
logger.debug("About to housekeep by running [" + hibernateQuery
+ "], where clientId [" + clientId
+ "], createdDateTime [" + cal.getTime().getTime()
Session session = this.sessionFactory.openSession();
try
Query query = session.createQuery(hibernateQuery.toString());
query.setParameter(CLIENT_ID, clientId);
query.setParameter(CREATED_DATE_TIME, cal.getTime().getTime());
sb.append(hibernateQuery.toString());
sb.append("].");
logger.error(sb.toString() + " " + e.getMessage(), e);
throw e;
代码示例来源:origin: net.sourceforge.openutils/openutils-spring-rmibernate
throw new RemoteException(ex.getMessage(), ex);
代码示例来源:origin: org.sakaiproject.samigo/samigo-services
Session session = null;
try {
session = getSessionFactory().openSession();
String query0 = "select LOCATION from SAM_MEDIA_T where MEDIAID = :id";
mediaLocation = (String) session.createSQLQuery(query0).setLong("id", mediaId).uniqueResult();
log.debug("****mediaLocation=" + mediaLocation);
log.warn(e.getMessage());
} finally {
if (session != null) {
代码示例来源:origin: Transitime/core
Session session = sessionFactory.openSession();
Query query = session.createQuery(hql);
} catch (HibernateException e) {
logger.error(e.getMessage(), e);
return null;
} finally {
代码示例来源:origin: Transitime/core
try {
Transaction tx = session.beginTransaction();
int numUpdates = session.createQuery(hql).executeUpdate();
logger.error("Could not delete DbTest objects. {}. {}",
e.getCause().getMessage(),
e.getMessage());
throw e;
} finally {
代码示例来源:origin: com.opensymphony.propertyset.providers/hibernate4
public void remove(String entityName, Long entityId, String key)
{
Session session = null;
try
{
session = this.sessionFactory.openSession();
session.delete(HibernatePropertySetDAOUtils.getItem(session, entityName, entityId, key));
session.flush();
}
catch (HibernateException e)
{
throw new PropertyException("Could not remove key '" + key + "': " + e.getMessage());
}
finally
{
try
{
if (session != null)
{
session.close();
}
}
catch (Exception e)
{
}
}
}
}
代码示例来源:origin: Transitime/core
if (sqlClause != null)
hql += " " + sqlClause;
Query query = session.createQuery(hql);
@SuppressWarnings("unchecked")
List<MonitoringEvent> monitorEvents = query.list();
logger.debug("Getting MonitoringEvent from database "
+ "took {} msec", timer.elapsedMsec());
return monitorEvents;
} catch (HibernateException e) {
logger.error(e.getMessage(), e);
return null;
} finally {
代码示例来源:origin: org.ikasan/ikasan-connector-basefiletransfer
FileFilter resultObject = null;
Session session = this.sessionFactory.openSession();
try
Query query = session.createQuery(hibernateQuery.toString());
query.setParameter(CLIENT_ID, qo.getClientId());
if (filterOnFilename)
sb.append(hibernateQuery.toString());
sb.append("]."); //$NON-NLS-1$
logger.error(sb.toString() + " " + e.getMessage(), e); //$NON-NLS-1$
throw e;
代码示例来源:origin: Transitime/core
Query query = session.createQuery(hql);
try {
List<DbTest> dbTests = query.list();
} catch (HibernateException e) {
logger.error("Could not get DbTest object. {}. {}",
e.getCause().getMessage(), e.getMessage());
throw e;
} finally {
代码示例来源:origin: vatri/spring-rest-ecommerce
public String addProductImage(final String productId, final String filename){
Session session = sessionFactory.openSession();
session.beginTransaction();
ProductImage image = new ProductImage();
image.setProductId(Long.parseLong(productId));
image.setPath(filename);
try {
String res = session.save(image).toString();
session.getTransaction().commit();
return res;
} catch (HibernateException e) {
System.out.print(e.getMessage());
session.getTransaction().rollback();
} finally {
session.close();
}
return "";
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
public void testIllegalMixedTransformerQueries() {
Session session = openSession();
Transaction t = session.beginTransaction();
try {
getSelectNewQuery( session ).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).list();
assertTrue(he.getMessage().indexOf("ResultTransformer")==0);
assertTrue(he.getMessage().indexOf("ResultTransformer")==0);
代码示例来源:origin: com.opensymphony.propertyset.providers/hibernate4
session = this.sessionFactory.openSession();
throw new PropertyException("Could not remove all keys: " + e.getMessage());
代码示例来源:origin: Transitime/core
" WHERE time >= :beginDate " +
" AND time < :endDate";
Query query = session.createQuery(hql);
@SuppressWarnings("unchecked")
List<ArrivalDeparture> arrivalsDeparatures = query.list();
logger.debug("Getting arrival/departures from database took {} msec",
timer.elapsedMsec());
return arrivalsDeparatures;
} catch (HibernateException e) {
Core.getLogger().error(e.getMessage(), e);
return null;
} finally {
代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl
@Transactional(readOnly = true)
public List<MessageBundleProperty> getModifiedProperties(int sortOrder, int sortField, int startingIndex, int pageSize) {
String orderBy = "asc";
if (sortOrder == SORT_ORDER_DESCENDING) {
orderBy = "desc";
}
String sortFieldName = "id";
if (sortField == SORT_FIELD_MODULE) {
sortFieldName = "moduleName";
}
if (sortField == SORT_FIELD_PROPERTY) {
sortFieldName = "propertyName";
}
if (sortField == SORT_FIELD_LOCALE) {
sortFieldName = "locale";
}
if (sortField == SORT_FIELD_BASENAME) {
sortFieldName = "baseName";
}
org.hibernate.Query query = null;
String queryString = "from MessageBundleProperty where value != null order by " + sortFieldName + " " + orderBy;
try {
query = getSessionFactory().getCurrentSession().createQuery(queryString);
query.setFirstResult(startingIndex);
query.setMaxResults(pageSize);
return query.list();
} catch (HibernateException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
代码示例来源:origin: org.nuiton.topia/topia-persistence
protected void rollback0(boolean beginAfterRollback) {
try {
Session hibernateSession = hibernateSupport.getHibernateSession();
Transaction transaction = hibernateSession.getTransaction();
hibernateSession.clear();
transaction.rollback();
hibernateSession.close();
sessionRegistry.unregister(hibernateSession);
if (beginAfterRollback) {
// it's very important to change the session after rollback
// otherwise there are many error during next Entity's modification
hibernateSession = hibernateSupport.getHibernateFactory().openSession();
hibernateSupport.setHibernateSession(hibernateSession);
hibernateSession.setFlushMode(FlushMode.MANUAL);
sessionRegistry.register(hibernateSession, this);
hibernateSession.beginTransaction();
}
getTopiaFiresSupport().fireOnPostRollback(this);
} catch (HibernateException eee) {
String message = String.format("An error occurred during rollback operation: %1$s", eee.getMessage());
throw new TopiaException(message, eee);
}
}
代码示例来源:origin: bhdrkn/Java-Examples
public void delete(T entity) {
if (entity == null) {
throw new IllegalArgumentException("Entity Must not be Null");
}
try {
Session session = this.getCurrentSession();
Transaction transaction = session.beginTransaction();
session.delete(entity);
transaction.commit();
} catch (HibernateException e) {
LOG.error("Error while delete Entity. M: " + e.getMessage()
+ " C: " + e.getCause(), e);
}
}
内容来源于网络,如有侵权,请联系作者删除!