Top "Annotations" questions

In programming, annotations are used to add information to a code element which cannot be expressed by the type system.

Default method return value in Java interfaces

While working with annotations I stumbled accross the following piece of code (it's the Hibernate @NotNull annotation): @Target(value = {ElementType.…

java interface annotations language-features
Custom 404 using Spring DispatcherServlet

I've set up web.xml as below. I also have an annotation-based controller, which takes in any URL pattern and …

spring annotations http-status-code-404 web.xml
Provided id of the wrong type hibernate

I am getting error: org.hibernate.TypeMismatchException: Provided id of the wrong type for class BEntity. Expected: class BEntity, got …

java hibernate annotations type-mismatch
Constructor injection using Spring annotation @Autowired does not work

I have created 2 simple classes. Constructor of one class is annotated as @Autowired. It accepts the object of another class. …

spring annotations default-constructor constructor-injection
Why should anybody put annotations on the getters or setters when using JPA to map the classes?

Subject says it all... I see no advantage of people declaring annotations on the getters and/or setters so far. …

java hibernate jpa annotations mapping
What's the difference between the name argument in @Entity and @Table when using JPA?

I'm using JPA2 and both @Entity and @Table have a name attribute, e. g.: @Entity(name="Foo") @Table (name="Bar") …

java database jpa annotations persistence
Spring 3 Annotations - HibernateDaoSupport - Repository Requires Session Factory

I am getting an exception saying : java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required When trying to use the @Repository …

hibernate spring annotations autowired
Interfaces with hibernate annotations

i am wondering how i would be able to annotate an interface @Entity @Table(name = "FOLDER_TABLE") public class Folder …

java hibernate jpa annotations gilead
Retrofit 2 - Elegant way of adding headers in the api level

My Retrofit 2 (2.0.2 currently) client needs to add custom headers to requests. I'm using an Interceptor to add these headers to …

java header annotations retrofit retrofit2
Not annotated method overrides method annotated with @NotNull

I'm implementing a custom data structure that gives me some properties of sets and other properties of lists. For most …

java intellij-idea annotations notnull