Richard Huddleston (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=712020%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYjgwMjllNzY2...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16561?atlOrigin=eyJpIjoiYjgwMj...
) HHH-16561 (
https://hibernate.atlassian.net/browse/HHH-16561?atlOrigin=eyJpIjoiYjgwMj...
) Session::byId and Session::byMultipleIds do not respect @TenantId (
https://hibernate.atlassian.net/browse/HHH-16561?atlOrigin=eyJpIjoiYjgwMj...
)
Issue Type: Bug Affects Versions: 6.2.2 Assignee: Unassigned Components: hibernate-core
Created: 05/May/2023 18:05 PM Environment: Hibernate 6.2.2.Final, Postgres Priority: Major
Reporter: Richard Huddleston (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=712020%...
)
With this simple java object
{{@Entity
@Table(name = "tbl_message")
public class LmFflMessage
{ @Id @Column(name="message_id") public long messageId; @TenantId
@Column(name="session_id") public long sessionId; @Column(name="text")
public String text; }
}}
final LmFflMessage m = em
.createQuery("SELECT m FROM LmFflMessage m WHERE m.messageId=:message_id",
LmFflMessage.class)
.setParameter("message_id", msgId)
.getSingleResult();
Generates (correctly)
select
l1_0.message_id,
l1_0.session_id,
l1_0.text
from
tbl_message l1_0
where
l1_0.session_id = ?
and l1_0.message_id=?
final LmFflMessage m = session
.byId(LmFflMessage.class)
.withReadOnly(true)
.with(CacheMode.IGNORE)
.load(msgId);
Generates (incorrectly)
select
l1_0.message_id,
l1_0.session_id,
l1_0.text
from
tbl_message l1_0
where
l1_0.message_id=?
final LmFflMessage m = session
.byId(LmFflMessage.class)
.withReadOnly(true)
.with(CacheMode.IGNORE)
.load(msgId);
Generates (incorrectly)
select
l1_0.message_id,
l1_0.session_id,
l1_0.text
from
tbl_message l1_0
where
l1_0.message_id = any
(
https://hibernate.atlassian.net/browse/HHH-16561#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16561#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100225- sha1:7f918b6 )