annotations

Adding a constraint to a JPA or Hibernate entity column using annotations

I want to have a column for an entity which only accepts one of an enumerated set of values. For example let's say I have a POJO/entity class "Pet" with a String column "petType". I want petType to only allow one of three values: "cat", "dog", or "gorilla". How would I go about annotating the getPetType() method in order to have a dat...

Basic Hibernate/JPA Mapping question

I have to tables I want to map to each other. I want to populate 2 drop down lists: code_r and code_l. When i choose a value from code_r, code_l should display only certain records. In my database I have 2 tables: Table code_r =================== CODE INT LIBELLE VARCHAR And Table code_l =================== ID ...

Why I cann't use Spring and Blossom annotations?

I use Magnolia CMS and Blossom. When I add annotations to my classes I get something like this: annotations are not supported in -source 1.3 (use -source 5 or higher to enable annotations) @Template(value="Blossom Template")* Spring annotation(like @Controller) doesn't compaile too. Where is my mistake? My pom.xml dependenc...

how can i automatically generate a non id value in hibernate?

I am using hibernate annotations, spring, a sessionFactory and defining everything in a context.xml (like so..) <bean id="mySessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="myDataSource" /> <property name="annotatedClasses"> <...

HowTo extend Spring Annotation @Transactional

I have to use 3 different transaction managers in my webapp. So I wrote my own Annotation according to the Spring reference (Section 10.5.6.3 Custom shortcut annotations). One annotation (for using one specific transactionmanager) looks like this: import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import j...

Finding Annotations in IntelliJ IDEA

I can easily find all mentions of some annotation in my project using SSR (structural search and replace). For example I have following spring based code: class DashboardController { @RequestMapping("/dashboard") public void doDashboard() { [...] } } If I search by pattern org.springframework.web.bind.annotation.RequestMapp...

doctrine 2 Annotations and Zend Framework underscore convention

I am working through the doctrine 2 (Beta3) sandbox and trying to apply the Zend Framework coding convention of placing a leading underscore to private class members. When I query Address, while its private members are NOT underscored, i retrieve the object as expected. When I add the underscores, regenerate and repopulate the db, and th...

Using annotation to ensure that value returned by method is not discarded

String in Java is immutable. The following snippet is, broadly speaking, "wrong". String s = "hello world!"; s.toUpperCase(); // "wrong"!! System.out.println(s); // still "hello world!"!!! Despite this being "wrong", the code compiles and runs, perhaps to the confusion of many beginners, who must either be told what the mistake is, ...

Soap message response body modification help

I've been playing around with web services using jbossws-cxf. I don't think the issue is with the implementation I'm using but instead how the code is generated. Here is my pojo with the annotations for a web service. package com.matt.test.ws; import javax.jws.WebMethod; import javax.jws.WebResult; import javax.jws.WebService; import j...

Several pin colors on same map in MKMapView

I have a MKMapView in my app with several pins on it and I'd like to set different colors for each pin. My view controller is implementing MKMapViewDelegate and I've defined viewForAnnotation method. - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation { MKPinAnnotationView *annView=[...

@override annotation in JDK 1.6

I'm using JDK1.6. When I implement an interface and in the implementing class, if I give @override before my function names, Eclipse throws an compilation error. i.e. below code is wrong according to Eclipse. public class SomeListener implements ServletContextListener { @Override public void contextDestroyed(ServletContextEvent ...

How will add First Name, Last Name of the user as an annotation in the MKMapview

I am adding the annotations to the mapview with the addAnnotation. I have the latitude and longitude information drop the pin on this location. I want to show the name of the user on this location? How will i do this? ...

Storing a JSP HashMap without a mapping table?

Is it possible have two classes Template and TemplateItem, mapping to two database tables template and template_item, where they are joined using a Map<String, TemplateItem>? If so can it be done using annotations? The following results in three tables, ie adds an un-necessary mapping table. @Entity @Table(name = "template") public cl...

PHP Annotation Library

Hi, Which is the best PHP Annotation library out there? Thanks ...

How is annotation useful in PHP?

How is annotation useful in PHP? and I don't mean PHPDoc generically. I just want a real-world example or something, I guess. So, according to @Max's answer: Annotations accomplish the same thing as Abstract Factories, only via one line of specialized PHPDoc. – hopeseekr 0 secs ago edit ...

hibernate using annotations or using hibernate configuration files.

I have seen many tutorials where the hibernate is implemented using annotations (basically hibernate annotations or JPA annotations). There are tutorial which mainly focuses on using the hibernate configuration files(hbm.xml files). No use of annotations at all. Now I am little bit confused, which one is better approach ? ...

iPhone: How to reenable MKUserLocation 'blue dot'?

Enabling the 'blue dot' which shows current location in my application by mapView.showsUserLocation = YES Disabling/hiding the dot by mapView.showsUserLocation = NO in order to drop a pin. So far so good. Adding an annotation pin at 'userLocation' and dragging it around in the map to a new location. After that I want to show the...

Java Annotation Overloading?

In my project, I have defined the an annotation similar to the following: (Omitting @Retention, @Target for brevity) public @interface DecaysTo { String[] value(); } Since originally writing it, our needs have changed and I have now defined an enum that I want to be able to use in place of the string: public enum Particle { E...

Add Error on GET METHOD Spring annotated controller

Hi All, Please help me with what I want to do. I have this scenario: I display a list of assets to users. User selects an asset and then clicks add item On my requestmapping, during GET operation. I use the service class to check if indeed this asset still exist in DB If not, user should be notified by a message. I use the form:err...

Java 6 annotation processing configuration with Ant

I have a custom annotation and it's processor & processorFactory. How do I configure my Ant build file such that: The annotation processor is applied on annotated classes and generates source files inside "gen" folder The generated source files(from annotation processing) could be used by other source files in project. ...