annotations

Narrowing problem with Spring MVC annotation-based controller and @RequestMapping

Consider this Spring MVC Controller: @Controller @RequestMapping("/test*") public class TestController { @RequestMapping(method = RequestMethod.GET) public void doStuff(Model model){ ... } @RequestMapping(params = "myParam") public void doStuff(@RequestParam("myParam") int myParam, Model model){ ... } } When I p...

Post-injection initialisation (JSF 1.2 + Guice)

I'm trying to integrate Guice into a JSF 1.2 (Sun RI) application, and I want to be able to do the following to my managed-beans: Inject dependencies using the Guice @Inject annotation, then Perform initialisation using the @PostConstruct annotation My problem is that the @PostConstruct method is always invoked before the @Inject ann...

configurable vs component with spring and aspectj

When using aspectj, why use @Component over @Configurable. I've got spring and aspectj setup for @Transactional support, aspects on self-invocation, and injection into JPA entities. This works great. I'm using @Component for most classes that need injection, and thus either having them injected into their dependencies. Or, when I can'...

Hibernate Annotations, specifying which members of a component to make persistent

I have a Price object consisting of two MonetaryValues where one MonetaryValue consists of an amount and a currency. If I configure the OR-mapping the XML-way, I can do this <component name="baseAmount" lazy="false" class="MonetartyValue"> <property name="amount" column="baseAmount" precision="20" scale="2" not-null="true"...

Optional injection in EJB3 bean or runtime dependency checks

I want to define injection so that only if the injected interface has EJB it will be injected. This is used as a plug-in to the main EJB. How to do this? Is there some annotation for this? I can use @PostConstruct to manually "inject" the variable. But then I have to handle the dependencies by myself. How can I handle dependencies knowi...

Using an Entity (and their Primary Key) as another Entity's Id

So, I'm not sure how to ask this question, as it seems like it should be pretty easy to find the answer to this one. I have 3 tables; ContentHeader, ContentType1 and ContentType2. ContentHeader has a primary, auto-increment key. ContentType1 and ContentType2 both maintain foreign keys to ContentHeader's primary key. These foreign keys ...

Data binding of @ModelAttribute annotated parameters

I have a Spring 2.5 annotated Controller in which I have a method annotated with @RequestMapping(method=RequestMethod.GET), which performs some logic to fill the model. I also have a method annotated with @RequestMapping(method=RequestMethod.POST) which performs the request. This method has a @ModelAttribute annotated parameter that con...

Dynamically annotate HTML?

I would like to do the following in an ASP.NET page, for both Internet Explorer and Firefox: Display an uploaded HTML document in a window. Allow the user to highlight an arbitrary section with the standard text cursor, and press a "leave comment here" button. Save the exact start and end points of the highlight -- not just the highli...

How I can disable the second-level cache of some certain entities in Hibernate without changing annotations

Hello, I'm using Hibernate second level cache in my application, for certain business reason I can't change the entity annotation any more. In my project, apart from changing the Database from Hibernate, there exist also other native SQL that do not go through Hibernate. Therefore, the Hibernate second-level cache data could be stale a...

Modifying property names in JPA queries

I'm using a convention of prefixing field names with an underscore. When I generate annotate entity classes with such fields I am stuck to using the underscore-prefixed property names in queries. I want to avoid that, and be able to do: @Entity public class Container { private String _value; } // in a lookup method executeQuery("f...

How do I map a nested collection, Map<Key,List<Values>>, with hibernate JPA annotations?

I have a class I am not sure how to annotate properly. My goal for Holder::data: List should maintain order not by comparator but by the natural ordering of the elements in the array. (Which can be an ndx column if that is helpful.) Holder will have the only reference to data, so Cascade all is probably applicable as well. I am al...

How is a blob column annotated in Hibernate?

How is a blob column annotated in Hibernate? So far I have a class that has: @Column( name = "FILEIMAGE" ) private byte[ ] fileimage ; // public byte[ ] getFileimage ( ) { return this.fileimage ; } public void setFilename ( String filename ) { this.filename = filename ; } ...

FieldBridge for Timestamp in Hibernate Search

What is the FieldBridge for timestamp in HIbernate Search? @Field public java.sql.Timestamp approvedDate; ...

How to get a unique key for two fields with Hibernate?

I have two fields of an entity class which I don't want to be unique but to instead be used as composite fields for a key which must itself be unique. For example I have two fields (name and version) which can be the same for other records but together they must be unique. What is the best way to do that using Hibernate (with annotatio...

Hibernate mapping a second @Embeddable field in a subclass

I'm trying to map an @Embeddable object in a subclass whose parent class already has a field of that @Embeddable type. The hibernate Embeddable Objects documentation claims I can use the @AttributeOverrides to override the column names of an @Embeddable object: e.g. @Entity public class Person implements Serializable { // Persist...

Anyone know of simple paint/annotation control for .net?

I want a simple reusable control that I can use in a form to view and annotate images. Example usage: I load an image, or paste from clipboard to the control. Annotate image, e.g. draw red ring around a feature. Perhaps add some text. Save image, or copy to clipboard, in chosen format (i.e. so we can compress). ...

Accessing HttpServletRequest from AOP advice in Spring 2.5 with annotations

Hi All, I have tried to find the answer to this question on both the Spring forum and by searching StackOverflow. I have found a lot of pages describing horrible architectures and asking for about the same thing as I do, but my intended usage is different so please bear with me :-) I have a Spring 2.5 project using annotation based for...

Eclipse complaining about @Override?

Hi, I have an existing project that uses @Override on methods that override INTERFACE methods, and not superclass methods. I cannot alter this in code, but I would like eclipse to stop complaining about the annotation, as I can still build with maven. How would I go about disabling this error? Note: Due to project requirements, I need ...

Grails Ignoring @Id Annotation

I'm trying to use an existing database with Grails. My DataSource.groovy starts with this: import org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsAnnotationConfiguration dataSource { configClass = GrailsAnnotationConfiguration.class pooled = true driverClassName = "com.mysql.jdbc.Driver" username = "root" password...

Java: Should I add an @Override annotation when implementing abstract methods?

When overriding a virtual method in Java, use of the @Override annotation is recommended, but what if I implement an abstract method? Should I use @Override then as well? ...