我应该进行一个查询,选择一个合作伙伴所拥有的所有终端所做的所有事务:选择该合作伙伴时,其终端中有一个特定的终端。
我从Hibernate查询中接收到此异常:
nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
这是一个查询:
@Query(value = "SELECT T FROM Transaction as T WHERE T.terminal IN (select P
环境:
Java 11JBoss7.2Hibernate 5.3.7
我在java类(usuariupd)中用不同的名称属性映射了一个数据库字段(USUARIMOD),但是当我试图查询表时,我得到了这个错误。
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
...
Caused by: org.hibernate.exception.SQLGrammarException: could not extract Resu
我有三个实体:用户、团队和TeamInvite。每个用户都有一个团队。每个用户都可以通过创建一个TeamInvite来邀请其他用户加入他们的团队。当接受TeamInvite时,每个用户的*Team*都会被更新。TeamInvites不影响用户,只影响他们的团队。
@Entity
public class Team extends Model {
@OneToOne
public User user;
@ManyToMany(cascade=CascadeType.ALL) //I've also tried CascadeType.PERSIST
在进行一些数据源测试时,我编写了这个小型EJB。
@Stateless
@Remote(IEmpService.class)
@LocalBean
public class EmpService implements IEmpService {
@PersistenceContext
private EntityManager em;
public void removeAllEmps() {
em.createQuery("DELETE FROM Emp").executeUpdate();
}
public List<Emp>
我试图打印SQL查询结果,但表示列未找到,
public class SearchDriver {
@Autowired
EntityManager entityManager;
public void search(String key, String value){
List<Driver> resultDerivers = entityManager.createNativeQuery("select * from driver where "+key+"="+value).getResultList();
我创建了一个Postgres存储过程:
CREATE OR REPLACE FUNCTION GetUser(ipUserId integer)
RETURNS setof users AS $$
BEGIN
IF ipUserId is null THEN
return query select * from users A order by modifieddate desc;
END IF;
return query select * from users where iduser = ipUserId;
END;
$$ LANGUAGE plpgsql;
我尝试在j
我的应用程序中有一个简单的create查询( Spring 5.2.10 + Hibernate 5.4.3.1 + Weblogic 12c)。
它在我本地的weblogic服务器上运行良好,但在刷新时会在另一台weblogic服务器上出错。它们使用相同的数据源。
org.hibernate.exception.SQLGrammarException: could not execute statementjavax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not
执行带有in子句参数的EntityManageer delete native查询时出错。该参数的类型是List,我想做一些类似于-
List<UUID> ids = ...
entityManager.createNativeQuery("DELETE FROM FOO WHERE ID IN (:ids)")
.setParameter("ids", ids)
.executeUpdate();
我得到的例外是-
javax.persistence.PersistenceException: org.hiberna
下面是一些实体:
@Entity
public class Forest {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
public Forest() {
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
}
我想在表林中插入一些元素:
public class Main {
我有一个使用EJB3的项目,当代码抛出与SQL相关的异常时,它会向开发团队发送通知。因此,例如,使用以下代码:
Query q = getEntityManager().createNativeQuery(query);
List<Object[]> results = q.getResultList();
如果我犯了语法错误,就会捕获第一个异常java.lang.IllegalArgumentException: Parameter with that position [2] did not exist,该异常被发送给devs。在Eclipse中,我可以看到其他异常,比如jav
我想得到基于college_id的student_id,其中College包含了我正在查询的Set<Student> students.
@Query("SELECT clg.id FROM College clg WHERE clg.students.any() = (:student)")
public List<Object> getCollegeIdByStudent(@Param("student") Student student);
在student实例中传递的仅包含主键。引发的异常是
org.springframework
在我的Spring应用程序(Hibernate版本: 4.1.7.final)中,我有一个包含多个长的实体,如下所示:
@Entity
@Table(name = "foo")
public class Foo {
@Id
private Long id;
@ElementCollection
@CollectionTable(
name = "foo_numbers",
joinColumns = {@JoinColumn(
name =
我需要执行以下select操作:
select c.address from Customer c where lower(trim(c.name)) = :name
但我得到了以下异常:
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
我知道如何将trim与lower结合使用吗?
我使用的是Play框架(1.2.4),我创建了一个UserAccount对象,并将其部署到Heroku。效果很好。然后,我向UserAccount类添加了一个isAdmin字段,在本地部署它,它工作得很好(但我使用的是内存中的DB),然后我将它部署到Heroku上,现在我得到了以下异常:
2011-12-23T09:03:35+00:00 app[web.1]: play.exceptions.JavaExecutionException: org.hibernate.exception.SQLGrammarException: could not load an entity: [model
我的申请有点麻烦。它在我的开发环境中工作,但不工作在我的客户服务器上。
带有时间戳的generate_series无法工作。相同的函数,但用整数工作。
错误消息:
[Request processing failed; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query] with root cause
org.postgresql.util.PSQLException: ERRO
我正在尝试批量删除
@NamedQuery(name=CalcData.DELETE,
query="delete from CalcData as model where model.dataLocation.locCountries = :locCountries and model.locPeriod= :locPeriod")
问题是hibernate将其翻译为
Hibernate:
delete
from
smart_rise.Calc_Data cross
join
smart_rise.Data_Location datalocati1_
目前,我在为我的springboot项目获取mysql数据时遇到了问题:
出现了意外错误(type=Internal服务器错误,status=500)。无法提取ResultSet;SQL n/a;嵌套异常是org.hibernate.exception.SQLGrammarException:无法提取ResultSet
TestEntity.java
@Entity
public class TestEntity implements Serializable {
@Id
private int id;
private String p1;
private S