Itsik Mauyhas
Itsik Mauyhas

Reputation: 4004

H2 - An illegal reflective access operation has occurred

After starting my spring-boot app a warning-

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.hibernate.internal.util.ReflectHelper (file:/C:/Users/xxxx/.m2/repository/org/hibernate/hibernate-core/5.3.7.Final/hibernate-core-5.3.7.Final.jar) to field java.lang.String.coder
WARNING: Please consider reporting this to the maintainers of org.hibernate.internal.util.ReflectHelper
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Has a result my table has a Coder column instead of the actual name like my Entity -

@Entity
public class TaxValuesEntity {

    @EmbeddedId
    public String countryCodePK;
    public double taxValue;
    public Timestamp creationAt;
    public Timestamp modifedAt;

    protected TaxValuesEntity() {
    };

    public TaxValuesEntity(String countryCode, double taxValue, Timestamp creation, Timestamp modifed) {
        this.countryCodePK = countryCode;
        this.taxValue = taxValue;
        this.creationAt = creation;
        this.modifedAt = modifed;
    }
    //getters & setters ...
};

Thank's for any help and please comment below if more code needed.

Upvotes: 3

Views: 2997

Answers (2)

ctenescu
ctenescu

Reputation: 104

I had a similar issue with JDK11 and Mockito. The fix was to use latest version of Mockito. Maybe check the version of Hibernate and the current support status for JDK 11. On a quick search, found this using hibernate with jdk11 and hibernate release 5.4

Upvotes: 2

user10639668
user10639668

Reputation:

Replace EmbeddedId with Id like this:

import javax.persistence.Id;

@Entity
public class TaxValuesEntity {

    @Id
    public String countryCodePK;

EmbeddedId is for composite primary key.

Upvotes: 1

Related Questions