Skip to content

Conversation

dreab8
Copy link
Member

@dreab8 dreab8 commented Sep 24, 2025

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


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.


metadataSources.addInputStream( getClass().getResourceAsStream( "no-file-level-catalog-and-schema.hbm.xml" ) );
metadataSources.addInputStream( getClass().getResourceAsStream( "database-object-using-catalog-placeholder.hbm.xml" ) );
metadataSources.addInputStream( getClass().getResourceAsStream( "database-object-using-schema-placeholder.hbm.xml" ) );
metadataSources.addInputStream( getClass().getResourceAsStream( "database-object-using-catalog-placeholder.orm.xml" ) );

Check warning

Code scanning / CodeQL

Unsafe use of getResource Warning test

The idiom getClass().getResource() is unsafe for classes that may be extended.
metadataSources.addInputStream( getClass().getResourceAsStream( "database-object-using-catalog-placeholder.hbm.xml" ) );
metadataSources.addInputStream( getClass().getResourceAsStream( "database-object-using-schema-placeholder.hbm.xml" ) );
metadataSources.addInputStream( getClass().getResourceAsStream( "database-object-using-catalog-placeholder.orm.xml" ) );
metadataSources.addInputStream( getClass().getResourceAsStream( "database-object-using-schema-placeholder.orm.xml" ) );

Check warning

Code scanning / CodeQL

Unsafe use of getResource Warning test

The idiom getClass().getResource() is unsafe for classes that may be extended.

context.getMetadataCollector().getDatabase().addAuxiliaryDatabaseObject( auxDbObject );
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should move this to a dedicated binder related to mapping.xml. Ultimately we will drop hbm.xml processing and woould be better at that point to not have to sift through hbm.xm-processing code to pull out bits related to mapping.xml. Does that make sense?

Comment on lines +25 to +27
context.getBootstrapContext().getClassLoaderService()
.classForName( databaseObjectRegistration.definition() )
.newInstance();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
Class.newInstance
should be avoided because it has been deprecated.
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.

3 participants