Skip to content

HHH-19324 - Switch tests using hbm.xml to use mapping.xml #9956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2025

Conversation

sebersole
Copy link
Member

@sebersole sebersole commented Apr 3, 2025

HHH-19324 - Switch tests using hbm.xml to use mapping.xml
HHH-19310 - Simplified declaration of type for basic mappings in XML

This is preliminary work which is converting tests using hbm.xml mappings to instead use mapping.xml and addressing gaps. Ultimately this PR will get merged into main (7.x).

Once all tests have been converted and gaps addressed (which just might mean Jira created for thre moment), we can start actually removing the code for applying hbm.xml - though that will be 8.x specific


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.


https://hibernate.atlassian.net/browse/HHH-19324

@sebersole sebersole changed the title HHH-17503 - Remove support for hbm.xml mappings HHH-19324 - Switch tests using hbm.xml to use mapping.xml Apr 7, 2025
@Test
public void testFullQueryReference(SessionFactoryScope scope) {
scope.inTransaction(
session -> session.createQuery( "from DynamicCompositeIdBasic e where e.id.key1 = 1" ).list()

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
QueryProducerImplementor.createQuery
should be avoided because it has been deprecated.
@Test
public void testEmbeddedQueryReference(SessionFactoryScope scope) {
scope.inTransaction(
session -> session.createQuery( "from DynamicCompositeIdBasic e where e.key1 = 1" ).list()

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
QueryProducerImplementor.createQuery
should be avoided because it has been deprecated.
public void testFullQueryReference(SessionFactoryScope scope) {
scope.inTransaction(
(session) -> {
session.createQuery( "select e from DynamicCompositeIdManyToOne e" ).list();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
QueryProducerImplementor.createQuery
should be avoided because it has been deprecated.
scope.inTransaction(
(session) -> {
session.createQuery( "select e from DynamicCompositeIdManyToOne e" ).list();
session.createQuery( "select e from DynamicCompositeIdManyToOne e where e.id.key1 = 1" ).list();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
QueryProducerImplementor.createQuery
should be avoided because it has been deprecated.
(session) -> {
session.createQuery( "select e from DynamicCompositeIdManyToOne e" ).list();
session.createQuery( "select e from DynamicCompositeIdManyToOne e where e.id.key1 = 1" ).list();
session.createQuery( "select e from DynamicCompositeIdManyToOne e where e.id.key2.name = 'abc'" ).list();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
QueryProducerImplementor.createQuery
should be avoided because it has been deprecated.
public void testEmbeddedQueryReference(SessionFactoryScope scope) {
scope.inTransaction(
(session) -> {
session.createQuery( "select e from DynamicCompositeIdManyToOne e" ).list();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
QueryProducerImplementor.createQuery
should be avoided because it has been deprecated.
scope.inTransaction(
(session) -> {
session.createQuery( "select e from DynamicCompositeIdManyToOne e" ).list();
session.createQuery( "select e from DynamicCompositeIdManyToOne e where e.key1 = 1" ).list();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
QueryProducerImplementor.createQuery
should be avoided because it has been deprecated.
(session) -> {
session.createQuery( "select e from DynamicCompositeIdManyToOne e" ).list();
session.createQuery( "select e from DynamicCompositeIdManyToOne e where e.key1 = 1" ).list();
session.createQuery( "select e from DynamicCompositeIdManyToOne e where e.key2.name = 'abc'" ).list();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
QueryProducerImplementor.createQuery
should be avoided because it has been deprecated.
@Test
public void testUsage(SessionFactoryScope factoryScope) {
factoryScope.inTransaction( (session) -> {
session.createQuery( "from SimpleDynamicEntity" ).list();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
QueryProducerImplementor.createQuery
should be avoided because it has been deprecated.
public void testUsage(SessionFactoryScope factoryScope) {
factoryScope.inTransaction( (session) -> {
session.createQuery( "from SimpleDynamicEntity" ).list();
session.createQuery( "select e from SimpleDynamicEntity e" ).list();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
QueryProducerImplementor.createQuery
should be avoided because it has been deprecated.
factoryScope.inTransaction( (session) -> {
session.createQuery( "from SimpleDynamicEntity" ).list();
session.createQuery( "select e from SimpleDynamicEntity e" ).list();
session.createQuery( "select e from SimpleDynamicEntity e where e.name = 'abc'" ).list();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
QueryProducerImplementor.createQuery
should be avoided because it has been deprecated.
@Test
void testUsage(SessionFactoryScope factoryScope) {
factoryScope.inTransaction( (session) -> {
session.createQuery( "from SimpleEntity" ).list();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
QueryProducerImplementor.createQuery
should be avoided because it has been deprecated.
void testUsage(SessionFactoryScope factoryScope) {
factoryScope.inTransaction( (session) -> {
session.createQuery( "from SimpleEntity" ).list();
session.createQuery( "select e from SimpleEntity e" ).list();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
QueryProducerImplementor.createQuery
should be avoided because it has been deprecated.
factoryScope.inTransaction( (session) -> {
session.createQuery( "from SimpleEntity" ).list();
session.createQuery( "select e from SimpleEntity e" ).list();
session.createQuery( "select e from SimpleEntity e where e.name = 'abc'" ).list();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
QueryProducerImplementor.createQuery
should be avoided because it has been deprecated.
factoryScope.inTransaction( (session) -> {
session.setCacheMode( CacheMode.IGNORE );
int i = 0;
try (ScrollableResults sr = session.createQuery( "from DataPoint dp order by dp.x asc" )

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
QueryProducerImplementor.createQuery
should be avoided because it has been deprecated.
if ( ++i % nBeforeFlush == 0 ) {
s.flush();
s.clear();
try (ScrollableResults sr = session.createQuery( "from DataPoint dp order by dp.x asc" )

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
QueryProducerImplementor.createQuery
should be avoided because it has been deprecated.
@sebersole sebersole force-pushed the drop-hbm branch 3 times, most recently from 5ecc0f3 to a657c4c Compare May 1, 2025 16:48
@sebersole sebersole marked this pull request as ready for review May 1, 2025 16:48
@sebersole
Copy link
Member Author

Some initial work on converting hbm.xml mappings in tests to mapping.xml.

Additionally addresses the following, which were discovered during this process.

HHH-19310 - Simplified declaration of type for basic mappings in XML
HHH-19422 - Introduce @CollectionIdJavaClass
@sebersole sebersole merged commit 6fb622c into hibernate:main May 2, 2025
23 of 25 checks passed
@sebersole sebersole deleted the drop-hbm branch May 2, 2025 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant