annotations

Where to put hibernate annotations?

Where do i put my hibernate annotations? Is it the line above my instance variable? Or before the getter? Or before the setter? Or doesn't it really matter? Thanks a lot ...

Hibernate will not make indexes when creating tables from annotations

Hi, I'm using hibernate with hbm2ddl.auto=update so that it'll automatically generate my oracle tables for me (i've no intention of learning oracle's sql). So far, so good, until now i'm trying to get it to create an index. As far as i can tell, i've made my annotations correctly: package data; import javax.persistence.*; import org.hi...

How to Inject ManagedBeans in JSF2.0

Hi folks, I have got Controller-ManagedBeans and Model-ManagedBeans (like MVC-Pattern). Here my Controller: @ManagedBean @RequestScoped public class ProjectController { private ProjectData projectBean; //The Model-ManagedBean (see below)! private IProjectService projectService; //My Service-Layer public ProjectCon...

Enable Jackson to not output the class name when serializing (using Spring MVC).

Is there a way to force Jackson not to put the class name in the Json output? I asked a question that led to this question, but I'm asking what I hope is a more focused question. I'm using Spring MVC while doing this, but I'm not sure how much that matters. So, instead of {"NamedSystem":{"name":"Bob Dole","id":"0198b96c-fe18-4aa6-9e6...

flex chart annotationElement incorrect data points

I have 2 Y-axis on the chart and I am trying to use annotationElement's localToData to get the data points associated with a Point on the chart. The annotation Element is able to return a set of values for the point ( 1 Y - data, 1 -x data), But it is returning the values against one axis and not the other. Is there a way to associate ...

Adding Invariants to Interfaces in Java

I've been thinking about creating a Java framework that would allow programmers to specify invariants (pre- and post-conditions) on interfaces. The purpose would be to make code more robust and reduce the number of unit tests that would need to be written for different implementations of the same interface. I envisage creating some way ...

Spring 3 Annotated Configuration Picks up @Configuration and @Component but not @Controller

So I'm trying to configure my web app without XML and go the all annotated route. I have a few classes annotated with @Configuration and @Component that are getting picked up automatically, but for some reason my @Controller annotations aren't being recognized and mapped to their corresponding @RequestMapping values. My web.xml file loo...

Hibernate with Annotations and MySQL: Creation Date

Hey folks, I try to save the date of creation of my entity. I have found that approach. I tried to implement it but the date doesn't reach my db-table. import java.io.Serializable; import java.util.Date; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.PrePersist; @Entity public class Project im...

AOP with Local Variable Annotations

I want to use local variable annotations to do better AOP. One idea is to implement the Future<T> concept with a proxy using an annotation. @NonBlocking ExpensiveObject exp = new ExpensiveObject(); //returns immediately, but has threaded out instantiation of the ExpensiveObject. exp.doStuff(); //okay, now it blocks until it's finishe...

@Override on Implementation

Would you put the annotation in implementation class methods? Does it serve any purpose? If you mistype or don't have it, it is a compile error anyway. ...

Annotation in UIWebview in iphone sdk

Hello all, I need help for, scribbling on the webpage i.e where ever the user moves on the uiwebview there it should draw a line according to the touch moves. Is this possible. Can any one please help me in this. Thanks, Mrudula. ...

Use cases for implementing annotations

What are valid use cases for implementing annotations? When designing primarily annotation based configuration systems I occasionally need to create classes which implement annotations for code generation or programmatic configuration. The alternative involves mirroring the data contained in annotations into DTOs, which seems like an ...

Hibernate usage in a Servlet environment

I'm trying to create a domain object that contains objects in a read-only fashion but be able to modify which objects it points to. So in the example below I would like Hibernate to handle populating the Account and Category objects but I don't want to ever update those objects. However I may wish to change which Account or which Categ...

Checking if an annotation is of a specific type

I am using reflection to see if an annotation that is attached to a property of a class, is of a specific type. Current I am doing: if("javax.validation.Valid".equals(annotation.annotationType().getName())) { ... } Which strikes me as a little kludgey because it relies on a string that is a fully-qualified class-name. If the namesp...

Spring Transactional Management - Where to Place the Annotations?

If I have a transactionally managed class, in which I have two methods e.g void OuterMethod(Data somedata) { this.InnerMethod(somedata) } @Transactional("mymanager") void InnerMethod(Data somedata) { //writes some things } is this valid? I can't get it to write to the database for some reason, although it doesn't give me any...

Annotations on interfaces

Why annotations doesnt work in interfaces ? like: public interface IUser { [Required] string FirstName { get; set; } } now if i made a class to implement that public partial class Customer:IUser { public Customer() { } public string FirstName { get; set; } } it wouldnt enforce validation...

Autowiring a collection via the constructor with Spring

I have what seems to be a simple problem, as stated in the title. Here is the kind of class I have : public class Foo { @Autowired public Foo(@Qualifier("bar") Set<String> bar) { // ... } } Which I try to run with the following spring context : <context:annotation-config /> <util:set id="bar"> <value>tata</val...

Private field in java annotations

My jboss seam application compile in eclipse without error. When I try to compile manually I have had a error STATE_QUERY has private access @NamedQueries({ @NamedQuery(name = CurrentModuleState.FIND_MODULE_STATE, query = CurrentModuleState.STATE_QUERY) }) public class CurrentModuleState implements java.io.Serializabl...

how to use new scala 2.8.0 nested annotations

Hi folks, looks like when scala 2.8.0 is out, we can use nested @annotations in our persistence layers. But how? Can anyone please transform this from java to scala? Thanks. @NamedQueries({ @NamedQuery(name = "findAll", query="select p from Person p"), @NamedQuery(name = "findTheOne", query="select p from Person p where...

What is a good inheritance strategy with Hibernate and JPA?

Hi all, i have this situation: I have an entity, "Person", that contains all personal details of a person, like birth date, street address, municipality ecc ecc. And i have an entity "ClubMember" that describe a member of a club and contains some field like: registration date, type of member, credit, ecc ecc So, a ClubMember is a Perso...