annotations

Hibernate and Internationalization using Tables

Hi With regards to the answer on my previous post: http://stackoverflow.com/questions/3958529/internationalization-of-user-data/3958595#3958595 Would it be possible to use Hibernate to link these tables together using annotations (or something else?) so that the existing models and database queries do not have to change? J ...

What is the difference between Groovy's AnnotationNode and Java's annotation ?

Although the title says quite all, let me explain a little further. I've written a library in which I do some introspection on Java fields to have their annotation list (and more specifically to see if they have one or more specific annotations (like - say, @Id, @Child, @Parent). Here is an example of the kind of code I use : @Over...

Referencing a parameterized type from an annotation

I am trying to figure out how to reference a parameterized interface as an annotation attribute: public class Example { public interface MyService<T extends Number> { T someNumber(); } public class BaseServiceImpl<T extends Number> implements MyService<T> { @Override public T someNumber() { ...

Hibernate: How to generate Id from entity constructor parameters ?

How to generate id for entity using constructor parameters - is that possible ? I need that to make tree structure (category -> subcategories...) passing to constructor parent category id. Category category = new Category(parentId); CategoryDAO.add(category); ...

Annotation endpoint Location for JAX-WS

Hi, does exist a specific annotation to define the address of the endpoint. In fact, I want to remove the attribute address in the SPring file and move the annotation directly in the impl. class. Current: jaxws:endpoint id="dataManagerEndPoint" implementor="#dataManagerService" address="/datamanager/v1.0" @WebService public interf...

what are @Repository and @Autowired used for. (Spring)

Hi, I am learning java for 3 months and sometimes i can not understand the usage purpose of something. one topic was dependency injection and spring beans i figured out the finally =) now i confused with the two annotations @Autowired and @Repository. First What does Autowiring mean? then Why should i use them and what is the diffe...

Java: Annotated Annotations (and passing values)

Hello, I have a annotation that does include several other annotations, pretty much like this one here: @Component // Spring Component @Interface OsgiService { boolean isFactory() } meaning that all classes annotated with @OsgiService shall automatically also be annotated as @Component. Which works fine. Now however, I'd like to a...

Annotation processing with Maven and Java 5 (JPA)

I would like to use Criteria API in my new project and from what I understood, I also need to do annotation processing. Since there Java 5 on the server, how is this possible using Java 5 and Maven? ...

JPA Criteria Tutorial

I've been trying to find a JPA Criteria API tutorial but haven't been much successful. Do you know about any for beginners? I'd like to start using it in an Java5/Maven app to build complex search queries. ...

Complex Search Queries JPA

In my Wicket+JPA/Hibernate+Spring project, much of the functionality is based around the Inbox page where, using many filtering options (not all of them have to be used), users can restrict the set of objects they want to work with. I was wondering what the best strategy to implement this filtering is? In the old version of this applicat...

org.hibernate.MappingException: Unknown entity

I'm trying to work through Beginning Hibernate 2nd edition, and I'm stuck trying to put together the simple working example with HSQLDB. When I run ant populateMessages, I get [java] org.hibernate.MappingException: Unknown entity: sample.entity.Message [java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:194...

Hibernate: Add a property in my class that is not mapped to a db-table

I have a table tbl_sky that has 2 properties name and model and I would use Hibernate annotation like; @Entity @Table(name="tbl_sky") public class Sky implements Serializable { private String name; private String model; private String status; @Id public String getName() { return name; } . . . But I nee...

Maven + Hibernate annotations schema generation

I have a bunch of classes annotated with hibernate annotations. I'm using Maven, Hibernate and Spring. How can I generated the DB schema using hibernate3-maven-plugin's hbm2ddl? ...

Is there an unsupported operation annotation in Java?

Are there any annotations in java which mark a method as unsupported? E.g. Let's say I'm writing a new class which implements the java.util.List interface. The add() methods in this interface are optional and I don't need them in my implementation and so I to do the following: public void add(Object obj) { throw new UnsupportedOper...

Multiple Invocations of Spring Scheduled Task

Hey everyone, So I am having a bit of a problem with some scheduled tasks I have declared using Spring's @Scheduled annotation. First off here is my app-config: <beans <!--Namespaces-->> <!-- Search for annotated beans --> <context:component-scan base-package="com.my.package.task"/> <task:annotation-driven executor="myExe...

Hibernate @CollectionOfElements Annotation for internationalisation

Hi Does anyone know of a good example (on the net) of how to use the @collectrionOfElements annotations in Hibernate. I have existing model objects and I need to internationalize a few fields on each of them ie: Name, Description . . . Does this mean I do not have to change/add new tables and model objects as Hibernate will know how to...

Spring annotation configuration does not find directories/classes in JARs

I have the same problem as these guys: http://stackoverflow.com/questions/1242656/spring-annotation-based-controllers-not-working-if-it-is-inside-jar-file http://forum.springsource.org/showthread.php?t=64731 ...but the difference is that I use Maven 2 as a build tool. How do I achieve the same effect using Maven 2? I saw this soluti...

@ManyToMany in an abstract MappedSuperclass

Hi. I'm having the following design for my hibernate project: @MappedSuperclass public abstract class User { private List<Profil> profile; @ManyToMany (targetEntity=Profil.class) public List<Profil> getProfile(){ return profile; } public void setProfile(List<Profil> profile) { this.profile = prof...

Looking for simple recipe for Java Annotation

I've never written an annotation in Java. I've got a simple Java class for performance measurement. I call it PerfLog. Here's an example of its use: public class MyClassToTest { public String MyMethod() { PerfLog p = new PerfLog("MyClassToTest", "MyMethod"); try { // All the code that I want to time. return wh...

JAXB annotations to deal with same element name in different namespaces.

The problem that I am trying to solve is that JAXB cannot handle the parent and inherited objects of the same name in different namespaces. I have two schemas: schemaA.xsd <xs:schema xmlns:A="..."> <xs:complexType name="mytype"> ... schemaB.xsd <xs:schema xmlns:B="..." xmlns:A="..."> <xs:import namespace="..." schemaLocation="schem...