Example criteria doesn't include Id-Fields

Description

When using example criterias, fields annotated with @Id aren't added to generated sql

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 @Entity public class MdMaterialMinimal { @Id private String materialNumber; private String materialName; MdMaterialMinimal() { super(); } public MdMaterialMinimal(String materialNumber, String materialName) { super(); this.materialNumber = materialNumber; this.materialName = materialName; } }
1 2 3 4 5 6 7 Session session = entityManager.unwrap(Session.class); MdMaterialMinimal exampleEntity = new MdMaterialMinimal("4711", null); Example example = Example.create(exampleEntity); Criteria criteria = session.createCriteria(MdMaterialMinimal.class).add(example); System.out.println(criteria.uniqueResult());

results in

1 Hibernate: /* criteria query */ select this_.materialNumber as material1_5_0_, this_.materialName as material2_5_0_ from MdMaterialMinimal this_ where (1=1)

Environment

None

Status

Assignee

Unassigned

Reporter

Michael Bulla

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

4.3.7

Priority

Major
Configure