[
https://issues.redhat.com/browse/HIBERNATE-174?page=com.atlassian.jira.pl...
]
Victor Williams Stafusa da Silva updated HIBERNATE-174:
-------------------------------------------------------
Description:
This code works fine in Hibernate 5.4.13.Final, but gives a NullPointerException at
Hibernate 6.0.0.Alpha4:
Test file:
{code:title=Hbug.java|borderStyle=solid}
package com.example;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import javax.persistence.spi.PersistenceProvider;
import org.hibernate.SessionFactory;
import org.hibernate.jpa.HibernatePersistenceProvider;
/**
* @author Victor Williams Stafusa da Silva
*/
public class Hbug {
public static void main(String[] args) throws Exception {
Map<String, String> props = new HashMap<>();
props.put("javax.persistence.jdbc.user", "sa");
props.put("javax.persistence.jdbc.password", "");
props.put("javax.persistence.jdbc.url",
"jdbc:hsqldb:mem:test1");
props.put("hibernate.hbm2ddl.import_files_sql_extractor",
"org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor");
props.put("javax.persistence.schema-generation.database.action",
"drop-and-create");
PersistenceProvider pp = new HibernatePersistenceProvider();
var spui = new SimplePersistenceUnitInfo(
Optional.empty(),
HibernatePersistenceProvider.class,
"test-1",
Set.of(Fruit.class),
props);
var emf = pp.createContainerEntityManagerFactory(spui, props);
if (!(emf instanceof SessionFactory)) throw new Exception("Bad EMF");
}
}
{code}
Utilitary class used by the above one:
{code:title=SimplePersistenceUnitInfo.java|borderStyle=solid}
package com.example;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.URL;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Properties;
import java.util.stream.Collectors;
import javax.persistence.SharedCacheMode;
import javax.persistence.ValidationMode;
import javax.persistence.spi.ClassTransformer;
import javax.persistence.spi.PersistenceProvider;
import javax.persistence.spi.PersistenceUnitInfo;
import javax.persistence.spi.PersistenceUnitTransactionType;
import javax.sql.DataSource;
/**
* @author Victor Williams Stafusa da Silva
*/
public final class SimplePersistenceUnitInfo implements PersistenceUnitInfo {
private final Optional<URL> url;
private final Class<? extends PersistenceProvider> providerClass;
private final String persistenceUnitName;
private final List<String> classes;
private final Map<String, String> properties;
public SimplePersistenceUnitInfo(
/*@NonNull*/ Optional<URL> url,
/*@NonNull*/ Class<? extends PersistenceProvider> providerClass,
/*@NonNull*/ String persistenceUnitName,
/*@NonNull*/ Collection<Class<?>> classes,
/*@NonNull*/ Map<String, String> properties)
{
this.url = url;
this.providerClass = providerClass;
this.persistenceUnitName = persistenceUnitName;
this.classes = classes.stream().map(Class::getName).collect(Collectors.toList());
this.properties = new HashMap<>();
this.properties.putAll(properties);
}
@Override
public String getPersistenceUnitName() {
return persistenceUnitName;
}
@Override
public String getPersistenceProviderClassName() {
return providerClass.getName();
}
@Override
public PersistenceUnitTransactionType getTransactionType() {
return PersistenceUnitTransactionType.RESOURCE_LOCAL;
}
@Override
//@Nullable
public DataSource getJtaDataSource() {
return null;
}
@Override
//@Nullable
public DataSource getNonJtaDataSource() {
return null;
}
@Override
public List<String> getMappingFileNames() {
return Collections.emptyList();
}
@Override
public List<URL> getJarFileUrls() {
try {
return
Collections.list(this.getClass().getClassLoader().getResources(""));
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
//@Nullable
@Override
public URL getPersistenceUnitRootUrl() {
return url.orElse(null);
}
@Override
public List<String> getManagedClassNames() {
return Collections.unmodifiableList(classes);
}
@Override
public boolean excludeUnlistedClasses() {
return false;
}
@Override
public SharedCacheMode getSharedCacheMode() {
return SharedCacheMode.UNSPECIFIED;
}
@Override
public ValidationMode getValidationMode() {
return ValidationMode.AUTO;
}
@Override
public Properties getProperties() {
Properties p = new Properties();
p.putAll(properties);
return p;
}
@Override
public String getPersistenceXMLSchemaVersion() {
return "2.2";
}
@Override
//@Nullable
public ClassLoader getClassLoader() {
return Thread.currentThread().getContextClassLoader();
}
@Override
public void addTransformer(ClassTransformer transformer) {
}
@Override
//@Nullable
public ClassLoader getNewTempClassLoader() {
return null;
}
}
{code}
Sample entity class:
{code:title=Fruit.java|borderStyle=solid}
package com.example;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* @author Victor Williams Stafusa da Silva
*/
@Entity
@Table(name = "fruits")
public class Fruit implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String name;
private String color;
public Fruit() {}
public Fruit(String name, String color) {
this.name = name;
this.color = color;
}
public String getName() {
return name;
}
public String getColor() {
return color;
}
}
{code}
Gradle script to build that:
{code:title=build.gradle|borderStyle=solid}
apply plugin: 'java'
apply plugin: 'application'
group = 'com.example'
mainClassName = 'com.example.Hbug'
repositories {
jcenter()
}
dependencies {
implementation 'org.hsqldb:hsqldb:2.5.0'
//implementation 'org.hibernate:hibernate-core:5.4.13.Final'
implementation 'org.hibernate.orm:hibernate-core:6.0.0.Alpha4'
}
{code}
Run the code above and a NullPointerException will be throw (with Hibernate 6.0.0.Alpha4).
However, if the gradle file is changed to use Hibernate 5.4.13 (uncomment that line and
comment the one for 6.0.0.Alpha4), then the code works as expected.
Here is the output, including the stack trace:
{code:title=output|borderStyle=solid}
Apr 07, 2020 7:19:53 AM org.hibernate.jpa.internal.util.LogHelper
logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [name: test-1]
Apr 07, 2020 7:19:54 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {6.0.0.Alpha4}
Apr 07, 2020 7:19:54 AM
org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
Exception in thread "main" java.lang.NullPointerException
at
org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.toClassDescriptor(ClassFileArchiveEntryHandler.java:84)
at
org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.toClassDescriptor(ClassFileArchiveEntryHandler.java:67)
at
org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.handleEntry(ClassFileArchiveEntryHandler.java:53)
at
org.hibernate.boot.archive.internal.JarFileBasedArchiveDescriptor.visitArchive(JarFileBasedArchiveDescriptor.java:147)
at
org.hibernate.boot.archive.internal.JarProtocolArchiveDescriptor.visitArchive(JarProtocolArchiveDescriptor.java:59)
at
org.hibernate.boot.archive.scan.spi.AbstractScannerImpl.scan(AbstractScannerImpl.java:40)
at
org.hibernate.boot.model.process.internal.ScanningCoordinator.coordinateScan(ScanningCoordinator.java:74)
at
org.hibernate.boot.model.process.spi.MetadataBuildingProcess.prepare(MetadataBuildingProcess.java:97)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:243)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:169)
at
org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:32)
at
org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:89)
at
org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilder(HibernatePersistenceProvider.java:166)
at
org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:141)
at com.example.Hbug.main(Hbug.java:31)
{code}
P.S.: I'm running this using and compiling this using Java 13.0.2.
was:
This code works fine in Hibernate 5.4.13.Final, but gives a NullPointerException at
Hibernate 6.0.0.Alpha4:
Test file:
{code:title=Hbug.java|borderStyle=solid}
package com.example;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import javax.persistence.spi.PersistenceProvider;
import org.hibernate.SessionFactory;
import org.hibernate.jpa.HibernatePersistenceProvider;
/**
* @author Victor Williams Stafusa da Silva
*/
public class Hbug {
public static void main(String[] args) throws Exception {
Map<String, String> props = new HashMap<>();
props.put("javax.persistence.jdbc.user", "sa");
props.put("javax.persistence.jdbc.password", "");
props.put("javax.persistence.jdbc.url",
"jdbc:hsqldb:mem:test1");
props.put("hibernate.hbm2ddl.import_files_sql_extractor",
"org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor");
props.put("javax.persistence.schema-generation.database.action",
"drop-and-create");
PersistenceProvider pp = new HibernatePersistenceProvider();
var spui = new SimplePersistenceUnitInfo(
Optional.empty(),
HibernatePersistenceProvider.class,
"test-1",
Set.of(Fruit.class),
props);
var emf = pp.createContainerEntityManagerFactory(spui, props);
if (!(emf instanceof SessionFactory)) throw new Exception("Bad EMF");
}
}
{code}
Utilitary class used by the above one:
{code:title=SimplePersistenceUnitInfo.java|borderStyle=solid}
package com.example;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.URL;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Properties;
import java.util.stream.Collectors;
import javax.persistence.SharedCacheMode;
import javax.persistence.ValidationMode;
import javax.persistence.spi.ClassTransformer;
import javax.persistence.spi.PersistenceProvider;
import javax.persistence.spi.PersistenceUnitInfo;
import javax.persistence.spi.PersistenceUnitTransactionType;
import javax.sql.DataSource;
/**
* @author Victor Williams Stafusa da Silva
*/
public final class SimplePersistenceUnitInfo implements PersistenceUnitInfo {
private final Optional<URL> url;
private final Class<? extends PersistenceProvider> providerClass;
private final String persistenceUnitName;
private final List<String> classes;
private final Map<String, String> properties;
public SimplePersistenceUnitInfo(
/*@NonNull*/ Optional<URL> url,
/*@NonNull*/ Class<? extends PersistenceProvider> providerClass,
/*@NonNull*/ String persistenceUnitName,
/*@NonNull*/ Collection<Class<?>> classes,
/*@NonNull*/ Map<String, String> properties)
{
this.url = url;
this.providerClass = providerClass;
this.persistenceUnitName = persistenceUnitName;
this.classes = classes.stream().map(Class::getName).collect(Collectors.toList());
this.properties = new HashMap<>();
this.properties.putAll(properties);
}
@Override
public String getPersistenceUnitName() {
return persistenceUnitName;
}
@Override
public String getPersistenceProviderClassName() {
return providerClass.getName();
}
@Override
public PersistenceUnitTransactionType getTransactionType() {
return PersistenceUnitTransactionType.RESOURCE_LOCAL;
}
@Override
//@Nullable
public DataSource getJtaDataSource() {
return null;
}
@Override
//@Nullable
public DataSource getNonJtaDataSource() {
return null;
}
@Override
public List<String> getMappingFileNames() {
return Collections.emptyList();
}
@Override
public List<URL> getJarFileUrls() {
try {
return
Collections.list(this.getClass().getClassLoader().getResources(""));
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
//@Nullable
@Override
public URL getPersistenceUnitRootUrl() {
return url.orElse(null);
}
@Override
public List<String> getManagedClassNames() {
return Collections.unmodifiableList(classes);
}
@Override
public boolean excludeUnlistedClasses() {
return false;
}
@Override
public SharedCacheMode getSharedCacheMode() {
return SharedCacheMode.UNSPECIFIED;
}
@Override
public ValidationMode getValidationMode() {
return ValidationMode.AUTO;
}
@Override
public Properties getProperties() {
Properties p = new Properties();
p.putAll(properties);
return p;
}
@Override
public String getPersistenceXMLSchemaVersion() {
return "2.2";
}
@Override
//@Nullable
public ClassLoader getClassLoader() {
return Thread.currentThread().getContextClassLoader();
}
@Override
public void addTransformer(ClassTransformer transformer) {
}
@Override
//@Nullable
public ClassLoader getNewTempClassLoader() {
return null;
}
}
{code}
Sample entity class:
{code:title=Fruit.java|borderStyle=solid}
package com.example;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* @author Victor Williams Stafusa da Silva
*/
@Entity
@Table(name = "fruits")
public class Fruit implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String name;
private String color;
public Fruit() {}
public Fruit(String name, String color) {
this.name = name;
this.color = color;
}
public String getName() {
return name;
}
public String getColor() {
return color;
}
}
{code}
Gradle script to build that:
{code:title=build.gradle|borderStyle=solid}
apply plugin: 'java'
apply plugin: 'application'
group = 'com.example'
mainClassName = 'com.example.Hbug'
repositories {
jcenter()
}
dependencies {
implementation 'org.hsqldb:hsqldb:2.5.0'
//implementation 'org.hibernate:hibernate-core:5.4.13.Final'
implementation 'org.hibernate.orm:hibernate-core:6.0.0.Alpha4'
}
{code}
Run the code above and a NullPointerException will be throw (with Hibernate 6.0.0.Alpha4).
However, if the gradle file is changed to use Hibernate 5.4.13 (uncomment that line and
comment the one for 6.0.0.Alpha4), then the code works as expected.
Here is the output, including the stack trace:
{code:title=output|borderStyle=solid}
Apr 07, 2020 7:19:53 AM org.hibernate.jpa.internal.util.LogHelper
logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [name: test-1]
Apr 07, 2020 7:19:54 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {6.0.0.Alpha4}
Apr 07, 2020 7:19:54 AM
org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
Exception in thread "main" java.lang.NullPointerException
at
org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.toClassDescriptor(ClassFileArchiveEntryHandler.java:84)
at
org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.toClassDescriptor(ClassFileArchiveEntryHandler.java:67)
at
org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.handleEntry(ClassFileArchiveEntryHandler.java:53)
at
org.hibernate.boot.archive.internal.JarFileBasedArchiveDescriptor.visitArchive(JarFileBasedArchiveDescriptor.java:147)
at
org.hibernate.boot.archive.internal.JarProtocolArchiveDescriptor.visitArchive(JarProtocolArchiveDescriptor.java:59)
at
org.hibernate.boot.archive.scan.spi.AbstractScannerImpl.scan(AbstractScannerImpl.java:40)
at
org.hibernate.boot.model.process.internal.ScanningCoordinator.coordinateScan(ScanningCoordinator.java:74)
at
org.hibernate.boot.model.process.spi.MetadataBuildingProcess.prepare(MetadataBuildingProcess.java:97)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:243)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:169)
at
org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:32)
at
org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:89)
at
org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilder(HibernatePersistenceProvider.java:166)
at
org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:141)
at com.example.Hbug.main(Hbug.java:31)
{code}
P.S.: I'm running this using
NullPointerException at
org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.toClassDescriptor -
Hibernate 6.0.0.Alpha4
-----------------------------------------------------------------------------------------------------------------------------------
Key: HIBERNATE-174
URL:
https://issues.redhat.com/browse/HIBERNATE-174
Project: Hibernate Integration
Issue Type: Bug
Reporter: Victor Williams Stafusa da Silva
Assignee: Steve Ebersole
Priority: Critical
This code works fine in Hibernate 5.4.13.Final, but gives a NullPointerException at
Hibernate 6.0.0.Alpha4:
Test file:
{code:title=Hbug.java|borderStyle=solid}
package com.example;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import javax.persistence.spi.PersistenceProvider;
import org.hibernate.SessionFactory;
import org.hibernate.jpa.HibernatePersistenceProvider;
/**
* @author Victor Williams Stafusa da Silva
*/
public class Hbug {
public static void main(String[] args) throws Exception {
Map<String, String> props = new HashMap<>();
props.put("javax.persistence.jdbc.user", "sa");
props.put("javax.persistence.jdbc.password", "");
props.put("javax.persistence.jdbc.url",
"jdbc:hsqldb:mem:test1");
props.put("hibernate.hbm2ddl.import_files_sql_extractor",
"org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor");
props.put("javax.persistence.schema-generation.database.action",
"drop-and-create");
PersistenceProvider pp = new HibernatePersistenceProvider();
var spui = new SimplePersistenceUnitInfo(
Optional.empty(),
HibernatePersistenceProvider.class,
"test-1",
Set.of(Fruit.class),
props);
var emf = pp.createContainerEntityManagerFactory(spui, props);
if (!(emf instanceof SessionFactory)) throw new Exception("Bad EMF");
}
}
{code}
Utilitary class used by the above one:
{code:title=SimplePersistenceUnitInfo.java|borderStyle=solid}
package com.example;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.URL;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Properties;
import java.util.stream.Collectors;
import javax.persistence.SharedCacheMode;
import javax.persistence.ValidationMode;
import javax.persistence.spi.ClassTransformer;
import javax.persistence.spi.PersistenceProvider;
import javax.persistence.spi.PersistenceUnitInfo;
import javax.persistence.spi.PersistenceUnitTransactionType;
import javax.sql.DataSource;
/**
* @author Victor Williams Stafusa da Silva
*/
public final class SimplePersistenceUnitInfo implements PersistenceUnitInfo {
private final Optional<URL> url;
private final Class<? extends PersistenceProvider> providerClass;
private final String persistenceUnitName;
private final List<String> classes;
private final Map<String, String> properties;
public SimplePersistenceUnitInfo(
/*@NonNull*/ Optional<URL> url,
/*@NonNull*/ Class<? extends PersistenceProvider> providerClass,
/*@NonNull*/ String persistenceUnitName,
/*@NonNull*/ Collection<Class<?>> classes,
/*@NonNull*/ Map<String, String> properties)
{
this.url = url;
this.providerClass = providerClass;
this.persistenceUnitName = persistenceUnitName;
this.classes =
classes.stream().map(Class::getName).collect(Collectors.toList());
this.properties = new HashMap<>();
this.properties.putAll(properties);
}
@Override
public String getPersistenceUnitName() {
return persistenceUnitName;
}
@Override
public String getPersistenceProviderClassName() {
return providerClass.getName();
}
@Override
public PersistenceUnitTransactionType getTransactionType() {
return PersistenceUnitTransactionType.RESOURCE_LOCAL;
}
@Override
//@Nullable
public DataSource getJtaDataSource() {
return null;
}
@Override
//@Nullable
public DataSource getNonJtaDataSource() {
return null;
}
@Override
public List<String> getMappingFileNames() {
return Collections.emptyList();
}
@Override
public List<URL> getJarFileUrls() {
try {
return
Collections.list(this.getClass().getClassLoader().getResources(""));
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
//@Nullable
@Override
public URL getPersistenceUnitRootUrl() {
return url.orElse(null);
}
@Override
public List<String> getManagedClassNames() {
return Collections.unmodifiableList(classes);
}
@Override
public boolean excludeUnlistedClasses() {
return false;
}
@Override
public SharedCacheMode getSharedCacheMode() {
return SharedCacheMode.UNSPECIFIED;
}
@Override
public ValidationMode getValidationMode() {
return ValidationMode.AUTO;
}
@Override
public Properties getProperties() {
Properties p = new Properties();
p.putAll(properties);
return p;
}
@Override
public String getPersistenceXMLSchemaVersion() {
return "2.2";
}
@Override
//@Nullable
public ClassLoader getClassLoader() {
return Thread.currentThread().getContextClassLoader();
}
@Override
public void addTransformer(ClassTransformer transformer) {
}
@Override
//@Nullable
public ClassLoader getNewTempClassLoader() {
return null;
}
}
{code}
Sample entity class:
{code:title=Fruit.java|borderStyle=solid}
package com.example;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* @author Victor Williams Stafusa da Silva
*/
@Entity
@Table(name = "fruits")
public class Fruit implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String name;
private String color;
public Fruit() {}
public Fruit(String name, String color) {
this.name = name;
this.color = color;
}
public String getName() {
return name;
}
public String getColor() {
return color;
}
}
{code}
Gradle script to build that:
{code:title=build.gradle|borderStyle=solid}
apply plugin: 'java'
apply plugin: 'application'
group = 'com.example'
mainClassName = 'com.example.Hbug'
repositories {
jcenter()
}
dependencies {
implementation 'org.hsqldb:hsqldb:2.5.0'
//implementation 'org.hibernate:hibernate-core:5.4.13.Final'
implementation 'org.hibernate.orm:hibernate-core:6.0.0.Alpha4'
}
{code}
Run the code above and a NullPointerException will be throw (with Hibernate
6.0.0.Alpha4). However, if the gradle file is changed to use Hibernate 5.4.13 (uncomment
that line and comment the one for 6.0.0.Alpha4), then the code works as expected.
Here is the output, including the stack trace:
{code:title=output|borderStyle=solid}
Apr 07, 2020 7:19:53 AM org.hibernate.jpa.internal.util.LogHelper
logPersistenceUnitInformation
INFO: HHH000204: Processing PersistenceUnitInfo [name: test-1]
Apr 07, 2020 7:19:54 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {6.0.0.Alpha4}
Apr 07, 2020 7:19:54 AM
org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
Exception in thread "main" java.lang.NullPointerException
at
org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.toClassDescriptor(ClassFileArchiveEntryHandler.java:84)
at
org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.toClassDescriptor(ClassFileArchiveEntryHandler.java:67)
at
org.hibernate.boot.archive.scan.spi.ClassFileArchiveEntryHandler.handleEntry(ClassFileArchiveEntryHandler.java:53)
at
org.hibernate.boot.archive.internal.JarFileBasedArchiveDescriptor.visitArchive(JarFileBasedArchiveDescriptor.java:147)
at
org.hibernate.boot.archive.internal.JarProtocolArchiveDescriptor.visitArchive(JarProtocolArchiveDescriptor.java:59)
at
org.hibernate.boot.archive.scan.spi.AbstractScannerImpl.scan(AbstractScannerImpl.java:40)
at
org.hibernate.boot.model.process.internal.ScanningCoordinator.coordinateScan(ScanningCoordinator.java:74)
at
org.hibernate.boot.model.process.spi.MetadataBuildingProcess.prepare(MetadataBuildingProcess.java:97)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:243)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:169)
at
org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:32)
at
org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:89)
at
org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilder(HibernatePersistenceProvider.java:166)
at
org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:141)
at com.example.Hbug.main(Hbug.java:31)
{code}
P.S.: I'm running this using and compiling this using Java 13.0.2.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)