Skip to content

Conversation

@mehmetali2003
Copy link

@mehmetali2003 mehmetali2003 commented May 18, 2025

Check for possible null values from metaData.getTypeInfo()


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-15993

@hibernate-github-bot
Copy link

hibernate-github-bot bot commented May 18, 2025

Thanks for your pull request!

This pull request appears to follow the contribution rules.

› This message was automatically generated.

@gavinking
Copy link
Member

This class is unused, and marked:

 * @deprecated This class is no longer used and will be removed
 */
@Deprecated(since = "7.0", forRemoval = true)

Also I don't see where it's documented that DatabaseMetaData.getTypeInfo() can return null.

So I don't see why you are proposing this change.

Check for possible null values from metaData.getTypeInfo()
@mehmetali2003
Copy link
Author

proposing

Sorry, I didn't look at documentation. I have just followed description of the issue.

@gavinking
Copy link
Member

Aaaah, there's an issue! You didn't put it in the issue title or the commit message so I missed it.

@gavinking gavinking changed the title NullPointerException from DatabaseMetaData validation HHH-15993 NullPointerException from DatabaseMetaData validation May 18, 2025
@gavinking
Copy link
Member

OK, so the issue was reported against Hibernate 5.2 running on Liberty:

The issue is that with no real DataSource available yet during server start, Liberty is returning null to
metaData.getTypeInfo(). This is causing Hibernate to throw a NullPointerException for resultSet.next().

It's unclear to me whether this should be counted as a bug in Hibernate or in Liberty, but it's very likely related to the infamous chicken/egg problem we're trying to solve at the spec level: jakartaee/persistence#650. @scottmarlow

Anyway, if this incompatibility still exists, the proposed patch won't help, because TypeInfo.extractTypeInfo is not called in H7.

@mehmetali2003
Copy link
Author

OK, so the issue was reported against Hibernate 5.2 running on Liberty:

The issue is that with no real DataSource available yet during server start, Liberty is returning null to
metaData.getTypeInfo(). This is causing Hibernate to throw a NullPointerException for resultSet.next().

It's unclear to me whether this should be counted as a bug in Hibernate or in Liberty, but it's very likely related to the infamous chicken/egg problem we're trying to solve at the spec level: jakartaee/persistence#650. @scottmarlow

Anyway, if this incompatibility still exists, the proposed patch won't help, because TypeInfo.extractTypeInfo is not called in H7.

Ok Gavin, thanks

@gavinking
Copy link
Member

Thank you @mehmetali2003, I'm going to close this.

@gavinking gavinking closed this May 21, 2025
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.

2 participants