lukas.schmidt (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5e42a78...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiOTVlN2E0NWE0...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-13860?atlOrigin=eyJpIjoiOTVlN2...
) HHH-13860 (
https://hibernate.atlassian.net/browse/HHH-13860?atlOrigin=eyJpIjoiOTVlN2...
) @Immutable entities generate warning even if they are not referenced in query (
https://hibernate.atlassian.net/browse/HHH-13860?atlOrigin=eyJpIjoiOTVlN2...
)
Issue Type: Bug Affects Versions: 5.4.11 Assignee: Unassigned Components: hibernate-core
Created: 12/Feb/2020 01:51 AM Environment: OpenJDK Runtime Environment (build
1.8.0_242-8u242-b08-0ubuntu3~18.04-b08)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)
Ubuntu 18.04 LTS
PostgreSQL 10+190ubuntu0.1 Priority: Minor Reporter: lukas.schmidt (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5e42a78...
)
We get this warning when executing the reported query:
HHH000487: The query: [update PvDb r set r.externalId = :externalId where r.id = :id]
attempts to update an immutable entity: [PV_DB]
We execute the following code (simplified):
String hql = "update PvDb r set r.externalId = :externalId where r.id =
:id" ;
Session session = sessionFactory.openSession();
Query query = session.createQuery(hql);
query.setParameter( "externalId" , externalId);
query.setParameter( "id" , id);
int updateCount = query.executeUpdate();
These two classes are mapped to the table PV_DB:
@Table(name = "PV_DB" )
@Entity
public class PvDb extends PvDbCommon
@Table(name = "PV_DB" )
@Entity
@Immutable
public class PvDbTO extends PvDbCommon
@MappedSuperclass
public class PvDbCommon
In the executed query, an object instanceof PvDb is referenced, but no PvDbTO.
Nevertheless the warning is shown. The update is executed successfully.
Expected result: The update is executed successfully, but no warning is shown.
(
https://hibernate.atlassian.net/browse/HHH-13860#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-13860#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#100119- sha1:c41815e )