Skip to content
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

Handle cases where IdentifiableType#getId(Class) returns null [DATAJPA-237] #642

Closed
spring-projects-issues opened this issue Jul 23, 2012 · 2 comments
Assignees
Labels
in: core status: declined type: enhancement

Comments

@spring-projects-issues
Copy link

spring-projects-issues commented Jul 23, 2012

Matthew T. Adams opened DATAJPA-237 and commented

The JPA specification's javadoc is ambiguous on whether or not IdentifiableType#getId(Class) (section 5.1.4, p.188) is allowed to return null. If an implementation returns null, SD JPA will throw a NullPointerException


Affects: 1.1 GA

Reference URL: http://forum.springsource.org/showthread.php?128639-NPE-using-SD-JPA-DN-with-a-single-entity-mapped-superclass

@spring-projects-issues
Copy link
Author

spring-projects-issues commented Aug 20, 2018

Jens Schauder commented

The specification of JPA 2.1 (and also 2.2) is no longer ambiguous:

public interface IdentifiableType<X> extends ManagedType<X> {
	
    /**
     *  Return the attribute that corresponds to the id attribute of 
     *  the entity or mapped superclass.
     *  @param type  the type of the represented id attribute
     *  @return id attribute
     *  @throws IllegalArgumentException if id attribute of the given
     *          type is not present in the identifiable type or if
     *          the identifiable type has an id class
     */
    <Y> SingularAttribute<? super X, Y> getId(Class<Y> type);

And this is handled in our code appropriately by checking the applicability of the method before calling it

@spring-projects-issues
Copy link
Author

spring-projects-issues commented May 22, 2019

Jens Schauder commented

Batch closing resolved issue without a fix version and a resolution indicating that there is nothing to release (Won't fix, Invalid ...)

@spring-projects-issues spring-projects-issues added status: declined type: enhancement in: core labels Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core status: declined type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants