annotations

Why does hibernate not find properties when I have hibernate.cfg.xml in my default package classpath?

I am having a bitch of a time getting this simple application working. I've got a configuration file in my default class path, using annotations with the correct class entries in the config file, and a default Session factory class that generated by the hibernate eclipse plug in tool. If I only rely on the default classpath config file, ...

@WebServlet annotation support in java 1.6.013

Hi, I'm stepping into the world of Servlets and 3.0 in particular and I saw certain methods and annotations used in examples and tutorials which talked about this being available when JAVA 6.0 is released (which it has) and now when I try to use the above annotation for example in Eclipse it does not recognize it although I have java 1.6...

Changing annotations in time series plots in R

While I can change annotations with the generic plot command turning off axes and annotations and specifying them again using the axis command e.g. cars <- c(1, 3, 6, 4, 9) plot(cars, type="o", col="blue", ylim=range(0, cars), axes=FALSE, ann=FALSE) axis(1, at=1:5, lab=c("Mon","Tue","Wed","Thu","Fri")) I cant do it with time series o...

What are the advantages of using named queries under Hiberante Annotation

Are there any advantages of using named queries vs what we have? Looking at performance, usability, maintainability etc etc.... In our application we have defined our queries as such: private static final String SELECT_CODE_FOR_STORE = "select DISTINCT code from Code code " + "join code.codeDescriptions codeDesc " + "j...

Adding validations to Java Beans via Annotations

I want to add validations to a Java Bean. For example, I want to do the following: @MaxLength(50) @RequiredField public void setEmployeeName(String name){ ..... } I know I can write code that gets the validations for a specific method by calling method.getDeclaredAnnotation after all the bean values have been set. I would like to...

incompatible types found: required: default enums in annotations

[javac] C:\ws\galileo\test\Cacheable.java:13: incompatible types [javac] found : com.io.CacheType [javac] required: com.io.CacheType [javac] public CacheType id() default CacheType.COMMON; I really don't get this one. I have a project where I'm custom building a caching interceptor for Spring. It simply is a look by cache name to p...

How to Customize the Annotations files

Hi all, I’m in the design phase of a project at the moment and the client wants a desktop app they can use to view and annotate “any” type of document. I’ve been doing some research into the WPF document viewer and XPS documents and it seems like a perfect fit because using the XPS document writer, you can print anything to an xps docum...

Adding an accessory view button to the MKMapView call out annotation?

Hi all, I've recently come across this website and I've been trying to add to my call out view a button (from a image). The code on the websites example works just fine, but when I tried to add in the same code to my project I'm not getting the same results. There is obviously something I've missed but I cannot seem to work this one o...

Mapping a Natural Key with Hibernate Annotations

Hi, I have a legacy table that uses a column that holds a date as the natural prmary key to the table. I am trying to map this with hibernate, but for the life of me I can't figure out how to get hibernate to map a single (none-compound) natural key as the Id. I have it mapped like this: @Id @Temporal(TemporalType.TIMESTAMP) @Column(...

Which types can be used for Java annotation members?

Today I wanted to create my first annotation interface following this documentation and I got the compiler error "Invalid type for annotation member": public @interface MyAnnotation { Object myParameter; ^^^^^^ } Obviously Object cannot be used as type of an annotation member. Unfortunately I could not find any information on ...

Can Java Annotations help me with this?

I'm wondering if there is a way to specify that a method gets called in advance of a class method. I know something like this should be posssible, since JUnit has before(), what I want to do is similar. Here is a concrete example of what I'd like to do class A { public void init(int a) { System.out.println(a); } @magic(arg=1) p...

Code style with Annotations

I can't make up my mind between @MyAnnotation public void foo(){} and @MyAnnotation public void foo(){} Is there a best-practice emerging? ...

Is it possible to use Java annotations, to achieve a similar functionality as a preprocessor

Is it possible to create a preprocessor like functionality that is available in C and provided by Antenna. Can we use the APT tool to achieve this functionality? Are there any articles or links on similar topics? ...

java annotations: library to override annotations with xml files

Java has annotations and that is good. However, some developers feel that it is best to annotate code with metadata using xml files - others prefer annotations but would use metadata to override annotations in source code. I am writing a Java framework that uses annotations. The question is: is there a standard way to define and parse m...

What is the difference between REMOVE and DELETE ?

Is there a difference between : @Cascade(org.hibernate.annotations.CascadeType.REMOVE) and @Cascade(org.hibernate.annotations.CascadeType.DELETE) ? ...

Attributes on Many-to-Many relationships (Hibernate)

Hi guys, I have entity classes A and C. They are mapping the tables tblA and tblC and have a many-to-many relationship between them, with tblB to map between them. tblB contains A_ID, C_ID and SetDate, the last one being the date it was set, thus an attribute to the relationship. My question is, how do I best map in this attribute? At t...

EJB3 Annotation

Hi All I am using JBoss 5 GA, I created a test Session bean, and local interface. I have created a servlet client. I tried to inject the interface in the servlet using @EJB.. But when I call this servlet I got the requested resource is not available!!!! When I comment the //@EJB, the page run successfully, any help please???? Jotnarta...

Setup Java 6 annotation processing configuration for eclipse compiler with maven

What's the best way to setup the eclipse project compiler configuration for Java 6 annotation processors? My solution is to setup the org.eclipse.jdt.apt.core.prefs and factorypath files manually. This is a bit cumbersome: Reference the processor jar in the factorypath file Configure the eclipse annotation processor output directory (...

iPhone MKMapKit application randomly crashing

I'm writing an MKMapKit app that allows the user to drag around an annotation. Everything seems to work for the most part, but it crashes every now and then with the following message: 2009-09-27 12:34:18.903 iParkNow![7181:207] *** -[LBSGAddressComponent _mapkit_cache_heapTime]: unrecognized selector sent to instance 0x195320 2009-09-...

XML Vs Annotations: Analytical approach

I intend to use the Pugh Decision Matrix to analytically reach a decision on this long running debate about the best approach (only with an academic interest though, it will be difficult to take sides). I invite you to suggest appropriate criteria for the comparison between these two approaches. ...