annotations

What is the Jaxb equivalent of a CData Block?

I am looking to convert a class that looks like this ... public class Amenity { public String id; public String value; } into the following XML using JaxB annotations: <amenity id="id-string-here">value-string-here</amenity> Does anyone know what annotation to use on the value member variable to accomplish this? The closest I...

Convert XML based configuration to Annotations

Is there any Utility available to convert XML based config files (say in Spring or Hibernate) to Annotations? If not would it be worthwhile to build such a tool? ...

How to add help prompt attributes to Business Objects in MVC and display in View

How can I provide some form of Attribute against my Business Objects in my ASP.Net MVC application so that I can pick up the help texts in the View and have them appear as pop-up hover help texts like this: <%= Html.TextBox("PostalCode", Model.PostalCode, new { title = "Please enter your postal code." })%> I want to be able to g...

Why doesn't the JPA spec (including 2.0) or Hibernate extension allow u to specify a generator e.g. Oracle sequence for the @Version annotation

I think the preamble of my use case cluttered my actual point, so I am restating more succinctly: Why can't @Version take a generator and allow me to assign a sequence to it like I can do for @Id; something like this @Entity @javax.persistence.SequenceGenerator( name="SEQ_STORE", sequenceName="my_sequence" ) public class Store i...

Issue with Annotation Views disappearing on double tap zoom

I've ran into a problem with annotation views in the MapKit on the iPhone. I manage to draw custom annotation views on the map - no problem there. I even manage to redraw them after dragging or zooming. However, there are cases where the redrawing does not work: an example would be double-tap zoom. I attach some code where I draw a few ...

Explanation about Annotations

Hi, Can anyone please explain what the following two paragraphs mean, in simple english? (Taken from http://www.ibm.com/developerworks/java/library/j-cwt08025.html) "Annotations are more flexible in terms of how you use them, with options for whether the annotation information is to be included in class files output by the c...

How do I turn off error validation for annotations in Intellij IDEA?

I have a developer counterpart who uses Eclipse, which inserts annotations in various positions automatically in our JUnit tests. However, when I open the test in IDEA, the annotation is underlined red, and the annotation reads "@Override is not allowed when implementing interface method". I don't really care about the annotation. It won...

Injecting annotated method parameters

In Java 6, is it possible to inject some value into a (@Target(ElementType.PARAMETER) and @Retention(RetentionPolicy.RUNTIME)-meta-annotated) method parameter? It's entirely possible to find the annotation at runtime using reflection, it's just that there seems to be no way of actually modifying the parameter's value. Or is that strict...

A question on JPA Cascading

I have two entities called User and UserProfile in my datamodel. Here is how they are mapped. Code from User Entity: @OneToOne(cascade=CascadeType.ALL) @PrimaryKeyJoinColumn public UserProfile getUserProfile(){ return this.userProfile; } public void setUserProfile(UserProfile userProfile){ this.userProfile=userProfile; } Cod...

Maintainability of Java annotations?

My project is slowly implementing Java annotations. Half of the developers - myself included - find that doing anything complex with annotations seems to add to our overall maintenance burden. The other half of the team thinks they're the bee's knees. What's your real-world experience with teams of developers being able to maintain an...

Marking a 3rd party class property as required (Java/Spring)

Recently, I hit a very perplexing error while trying to clean up my spring configs. The exception was being thrown from deep within a third party library and was basically an obfuscated NPE. What I would like to be able to do is configure spring to require a specific field on this class as being required, but I do not want to build a cu...

cannot access to annotated spring service

I'm trying to access @Service defined class Interfaces are defined, here is an implementation @Service public class TypeServiceImpl implements TypeService { @Autowired TypeDAO dao; public List<DocType> findAll() { System.out.println("accessing findAll"); //have no appearence return dao.findAll(); } ...

spring annotation configration issue

I donnt know why spring 2.5.6 keep complaining .. but i dont have any "orderBy" annotation... 2009-10-10 13:55:37.242::WARN: Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.annotation.internalPersiste nceAnnotationProcessor': Error setting property values; ne...

Multiple annotations of the same type on one element?

I'm attempting to slap two or more annotations of the same type on a single element, in this case, a method. Here's the approximate code that I'm working with: public class Dupe { public @interface Foo { String bar(); } @Foo(bar="one") @Foo(bar="two") public void haha() {} } When compiling the above, javac c...

Hibernate Inheritance Mapping and Attribute Override

The system I'm working on has a domain object named Order which inherits from AbstractPersistentObject. Now I need to add another domain object named ExternalOrder which has some of the properties of Order but not all. I would like these two objects to be treated polimorphically in certain places. Hence I'm thinking of implementing inher...

Alternatives to using text() to adding text to a plot

This may be a naive question, but I was wondering if there's a better way than using text() to adding text to a plot. Note, I'm also using layout() as well. Specifically, I have a section of a plot where I would like to add some text with headings followed by regular text. text() is fine it seems for simple annotations, but to get th...

Java .properties files as strongly typed classes

Is there way to get properties files as strongly typed classes? I guess there are code generators but doing it with annotations would be much cooler. What I mean is; foo.properties file keyFoo = valuefoo keyBar = valuebar maybe with @properties(file="foo.properties") class foo { } becomes class foo { String getKeyFoo() { } St...

Hibernate Annotations generating query that produces SQLGrammarException

Still duking it out with Hibernate... I'm using Hibernate-Annotations instead of hbm.xml files for my beans, but I'm currently running into a problem where the SQL that Hibernate is generating references nonexistent database columns. For instance, here is the code: Query q = session.createQuery("FROM Status ORDER BY post_date DESC"); ...

Consolidate annotations on a zoomed MKMapView

There are a number of bad ways to go about what I want to do, but this seems like one of those cases of "there must be a better way". I am using an MKMapView in an iPhone app that displays a number of annotations. Pretend for conceptual discussion that each town in a US state has an annotation, so there's a fairly dense pile of annotati...

Is it possible to ignore certain unit tests?

Hi, I'm currently working on a project which uses JUnit4 extensively throughout all the modules. We're using Maven2 to build the project and Hudson for continuous integration. The project is built and run under Java 1.5. We've recently added quite a large raft of unit tests which are needed at times, but don't want to be run during the ...