{code:java} @Entity @Access(AccessType.FIELD) public class D2 { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id", nullable = false) private int id;
@ManyToOne @JoinColumn(name = "customerId", nullable = false) private Customer customer; }
@Entity public abstract class AbstractD2Source { ... @OneToOne(optional = true) @JoinColumn(name = "dId", nullable = true) private D2 d; ... }
CriteriaDelete<AbstractD2Source> query = cb.createCriteriaDelete(AbstractD2Source.class); Root<AbstractD2Source> dSource = query.from(AbstractD2Source.class); query.where(cb.and( cb.equal(dSource.get(AbstractD2Source_. datafeed d ).get(D2_.customer), customer), datafeedSource.get(AbstractD2Source_.id).in(dSourceIds) )); return em.createQuery(query).executeUpdate(); {code}
The forementioned produces an error: Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'customerId' in 'where clause'
{code:java} 11.06. 14:37:14,087 INFO [stdout] (default task-1) Hibernate: insert into HT_dfSource select abstractda0_.id as id from dfSource abstractda0_ where customerId=1 and (abstractda0_.id in (1047)) 11.06. 14:37:14,096 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-1) SQL Error: 1054, SQLState: 42S22 11.06. 14:37:14,096 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (default task-1) Unknown column 'customerId' in 'where clause' {code} |
|