annotations

help with reflections and annotations in java

I'm having trouble with doubling up on my code for no reason other than my own lack of ability to do it more efficiently... for (Method curr: all){ if (curr.isAnnotationPresent(anno)){ if (anno == Pre.class){ for (String str : curr.getAnnotation(Pre.class).value()){ if (str.equals(...

Limit Annotation number in Mapkit

Hi all, I want to stop my app from loading more annotations after they are all added ( they are added by the user one by one), as the app otherwise crashes. How would you do that? the following code is what i think is important (void) loadAndSortPOIs { [poiArray release]; nextPoiIndex = 0; NSString *poiPath = [[NSBundle mainBundle] ...

question on database query using hibernate in java with annotations

Hello, simple question regarding HQL(Hibernate query language) so i have user class , that can hold a list of Projects, how do i take this out of the database depending on a username, this is how i take out my user String username = "stephen"; YFUser user = (YFUser) session.createQuery( "select u FROM YFUser u where u.usernam...

iPhone SDK: ReverseGeocoder updates too late?

I am using reverseGeocoder in a few places in my app. This particular instance, I am using it to update details about my annotation. I have created a property (MKPlacemark) which stores the new placemark each time the didFindPlacemark method runs. The problem is, it always seems to be behind by one update. Meaning, when my custom met...

iPhone mapKit annotation for Current Location

Hello Im currently strugglung with annotations. how can i prevent the AnnotationLable for the blue GPS-point. (Here is an Image) - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(MKAnnotation *) annotation{ if (annotation == mapView.userLocation) { return nil; } the function above isnt working, and i reali...

Mapping issue with multi-field primary keys using hibernate/JPA annotations

Hi all, I'm stuck with a database which is using multi-field primary keys. I have a situation where I have a master and details table, where the details table's primary key contains fields which are also the foreign key's the the master table. Like this: Master primary key fields: master_pk_1 Details primary key fields: maste...

Injecting Entitymanager via XML and not annnotations.

What I am trying to do is inject through XML almost the same way that is done through A @PersistenceContext annotation. I am in need of this because of the fact I have different entity managers I need to inject into the same DAO. The databases mirror one another and I would rather have 1 base class and for instances of that base class ...

[hibernate - jpa] @OneToOne annotoation problem (i think...)

Hi all, im new in hibernate and JPA and i have some problems with annotations. My target is to create this table in db (PERSON_TABLE with personal-details) ID ADDRESS NAME SURNAME MUNICIPALITY_ID First of all, i have a MUNICIPALITY table in db containing all municipality of my country. I mapped this table in this ENTI...

Can i have a negative value as constant expression in Scala?

I have an Java-Annotation that return a double value: @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface DoubleValue { double value(); } When i try to attach the annotation to a field in a scala class and the value is negativ like here: class Test { @DoubleValue(-0.05) var a = _ } i get an compi...

[hibernate - jpa] @CollectionOfElements without create the apposite table

EDIT Hi all. WHAT I TRY TO GET I want a table that represents a list of personal details, this table is called PERSON and must have this columns: ID NAME SURNAME STREET ID_CITY Well, i already have a table in my db that contains all municipalities of my country, this table is called MUNICIPALITY and has this column...

How to use @PersistentCapable annotation in Scala 2.8

Hi, I'm switching from Scala 2.7.7 to Scala 2.8.0RC3 and now a few of my classes don't compile anymore. The problem is in the @PersistentCapable annotation: import javax.jdo.annotations._ import java.util.Date @PersistenceCapable{identityType=IdentityType.APPLICATION} class Counter(dt: Date, cName: String, vl: int) { <.. snip ..> } ...

sequence generators are getting ignored

I'm getting the following error while saving a object. However similar configuration is working for other model objects in my projects. Any help would be greatly appreciated. @Entity @Table(name = "ENROLLMENT_GROUP_MEMBERSHIPS", schema = "LEAD_ROUTING") public class EnrollmentGroupMembership implements Serializable, Comparable,Auditabl...

Is there any tool for automatically generate java classes with annotation style in hibernate?

Hello, I just have the db schema, and want to get the corresponding java classes for them in hibernate, and I do not want the hbm xml file style, so want to get the java classes with annotation generated automatically, is there any tool for this job? Thanks a lot. ...

How to use Java annotations rention policy for CLASS

Hi all, I'm using annotations for generating documentation for an API that I'm publishing. I have it defined like this: @Documented @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface PropertyInfo { String description(); String since() default "5.8"; String link() default ""; } Now this ...

Is context:annotation-config an alternative to @AutoWired?

Is it correct that I can put context:annotation-config in my XML config and it will automatically inject the bean class without needing any annotations? So instead of using these annotation types: public class Mailman { private String name; @Autowired private Parcel Parcel; public Mailman(String name) { th...

What can you do and not do with java annotations?

The typical use-case is for simple things like @Override, but clearly you can do a lot more with them. If you push the limits of them, you get things like Project Lombok, though my understanding is that that's a huge abuse of annotations. What exactly can you do? What sort of things can you do at compile-time and run-time with annotation...

Android java.lang.VerifyError for private method with annotated argument.

I have a very simple project that compiles, but can't be started on Emulator. The problem is with this method: private void bar(@Some String a) {} // java.lang.VerifyError The issue can be avoided if annotation removed private void bar(String a) {} // OK or the method visibility changed: void bar(@Some String a) {} // OK public vo...

Why doesn't JSF 2.0 RI (Mojarra) scan my class' annotations?

I have a War and Jar project in my Eclipse-based JSF project. I have decided to use annotations to declare my FacesConverter, (among a myriad other things), rather than declare it using my faces-config.xml. @FacesConverter(value="passwordFieldStringConverter") public class PasswordFieldStringConverter implements Converter { public Ob...

strange data annotations issue in MVC 2

Hello, I came across something strange when creating an edit form with MVC 2. i realised that my error messages come up on form sumission even when i have filled ut valid data! i am using a buddy class which i have configured correctly ( i know that cos i can see my custom errors). Here is the code from the viewmodel that generates thi...

Mathematical annotations in a PDF file

I like to annotate papers I read in a digital way. Numerous programs exist to help in this process. For example, on OS X one can use programs such as Skim or even Preview. However, making annotations is dreadful when one wishes to add mathematical annotations, such as formulas or greek letters. A cumbersome "solution" is to select the de...