Skip to content

Wrong query generated when an EmbeddedId is used in a WHERE clause using the IN operator #2515

@dreab8

Description

@dreab8

Given

@Entity(name = "Delivery")
	@Table(name = "Delivery")
	public static class Delivery {

	@EmbeddedId
	private LocationId locationId;
}

@Embeddable
	public static class LocationId {

		@Column(name = "sp_country")
		private String country;

		@Column(name = "sp_city")
		private String city;
}

the following

s.createQuery( "from Delivery d where d.locationId in ?1" ).setParameter( 1, new LocationId( "Italy", "Verbania" ) ).getResultList()

generates the wtong sql query

select d1_0.sp_city,d1_0.sp_country,d1_0.field from Delivery d1_0 where (d1_0.sp_city,d1_0.sp_country) in (($1,$1))

the in operator values (($1,$1)) should be in (($1,$2))

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions