We're updating the issue view to help you get more done. 

Better error message when @Formula and @Id are combined

Description

An NullPointerException occurs when you use a @Formula annotation and a @Id annotation on the same class member.

Example Stacktrace:

Thread [pool-2-thread-2] (Suspended (exception NullPointerException))
Ejb3Column.forceNotNull() line: 477
AnnotationBinder.processElementAnnotations(PropertyHolder, Nullability, PropertyData, HashMap<String,IdentifierGeneratorDefinition>, EntityBinder, boolean, boolean, boolean, MetadataBuildingContext, Map<XClass,InheritanceState>) line: 2214
AnnotationBinder.processIdPropertiesIfNotAlready(Map<XClass,InheritanceState>, MetadataBuildingContext, PersistentClass, EntityBinder, PropertyHolder, HashMap<String,IdentifierGeneratorDefinition>, ElementsToProcess, boolean, Set<String>) line: 923
AnnotationBinder.bindClass(XClass, Map<XClass,InheritanceState>, MetadataBuildingContext) line: 750
AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(Set<String>) line: 259
MetadataBuildingProcess$2.processEntityHierarchies(Set<String>) line: 244
MetadataBuildingProcess.build(MetadataSources, MetadataBuilderImpl$MetadataBuildingOptionsImpl) line: 287
MetadataBuilderImpl.build() line: 413
MetadataBuilderImpl.build() line: 99
EntityManagerFactoryBuilderImpl.<init>(PersistenceUnitDescriptor, Map, ClassLoader) line: 200
Bootstrap.getEntityManagerFactoryBuilder(PersistenceUnitDescriptor, Map, ClassLoader) line: 51
HibernatePersistenceProvider.getEntityManagerFactoryBuilder(PersistenceUnitDescriptor, Map, ClassLoader) line: 182
HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(String, Map, ClassLoader) line: 131
HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(String, Map) line: 88
HibernatePersistenceProvider.createEntityManagerFactory(String, Map) line: 69
Persistence.createEntityManagerFactory(String, Map) line: 55
Persistence.createEntityManagerFactory(String) line: 39
LimitPosition.getLimpos() line: 24
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available
Method.invoke(Object, Object...) line: not available
ResourceMethodInvocationHandlerFactory$1.invoke(Object, Method, Object[]) line: 81
AbstractJavaResourceMethodDispatcher$1.run() line: 164
JavaResourceMethodDispatcherProvider$TypeOutInvoker(AbstractJavaResourceMethodDispatcher).invoke(ContainerRequest, Object, Object...) line: 181
JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(Object, ContainerRequest) line: 203
JavaResourceMethodDispatcherProvider$TypeOutInvoker(AbstractJavaResourceMethodDispatcher).dispatch(Object, ContainerRequest) line: 101
ResourceMethodInvoker.invoke(RequestProcessingContext, Object) line: 389
ResourceMethodInvoker.apply(RequestProcessingContext) line: 347
ResourceMethodInvoker.apply(Object) line: 102
ServerRuntime$2.run() line: 305
Errors$1.call() line: 271
Errors$1.call() line: 267
Errors.process(Callable<T>, boolean) line: 315
Errors.process(Producer<T>, boolean) line: 297
Errors.process(Runnable) line: 267
RequestScope.runInScope(RequestScope$Instance, Runnable) line: 317
ServerRuntime.process(ContainerRequest) line: 288
ApplicationHandler.handle(ContainerRequest) line: 1110
JdkHttpHandlerContainer.handle(HttpExchange) line: 179
Filter$Chain.doFilter(HttpExchange) line: not available
AuthFilter.doFilter(HttpExchange, Filter$Chain) line: not available
Filter$Chain.doFilter(HttpExchange) line: not available
ServerImpl$Exchange$LinkHandler.handle(HttpExchange) line: not available
Filter$Chain.doFilter(HttpExchange) line: not available
ServerImpl$Exchange.run() line: not available
ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker) line: not available
ThreadPoolExecutor$Worker.run() line: not available
Thread.run() line: not available

Environment

None

Status

Assignee

Steve Ebersole

Reporter

Thomas Meyer

Labels

None

Worked in

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Community Help Wanted

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Priority

Major