annotations

Does @Test(enabled = false) work for a class in TestNG?

From the TestNG doc I can see that (enabled = false) can be applied to a class or method. But it seems it only works when applied to a method. Anybody seen the same, found a solution? I'm running tests in ItelliJ IDEA 7.0 by the way. ...

JAXB Annotations - Mapping interfaces and @XmlElementWrapper

I am having trouble with JAXB annotations for a field that is a list whose generified type is an interface. When I have it declared such as: @XmlAnyElement private List<Animal> animals; Every thing works correctly. But when I add a wrapper element, such as: @XmlElementWrapper @XmlAnyElement private List<Animal> animals; I find tha...

questions on annotation + class member order

I would like to do something like this: public class Foobar { @Tag final private int foo; @Tag final private int bar; @Tag final private int baz; @Tag final private int quux; static private final TagValidator validator = TagValidator.autoGenerate(Foobar.class); public Foobar(Something something) { va...

Is there a way to get the javadoc tool to document annotations?

In my project, we use a number of annotations that would be very useful to see in the javadoc API documentation. Does anyone know a simple way to include annotations in generated javadocs? I don't want to write my own javadoc plugin. Are there any solutions out there? ...

Spring - How do you set Enum keys in a Map with annotations

Hi all, I've an Enum class public enum MyEnum{ ABC; } than my 'Mick' class has this property private Map<MyEnum, OtherObj> myMap; I've this spring xml configuration. <util:map id="myMap"> <entry key="ABC" value-ref="myObj" /> </util:map> <bean id="mick" class="com.x.Mick"> <property name="myMap" ref="myMap" /> </bean...

Configurable persistence in Java EE5+

There are 2 ways of using a persistence unit, code or annotation. CODE [..]EntityManagerFactory emf; emf = Persistence.createEntityManagerFactory("SOMEPU");[..] or ANNOTATION [..] @PersistenceContext(name = "persistence/LogicalName", unitName = "SOMEPU") [..] Question: If you want to change the persistence unit (or point to d...

Error setting a default null value for an annotation's field

Why am I getting an error "Attribute value must be constant". Isn't null constant??? @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface SomeInterface { Class<? extends Foo> bar() default null;// this doesn't compile } ...

Custom 404 using Spring DispatcherServlet

I've set up web.xml as below. I also have an annotation-based controller, which takes in any URL pattern and then goes to the corresponding jsp (I've set that up in the -servlet.xml). However, If I go to a page that ends in .html (and whose jsp doesn't exist), I don't see the custom 404 page (and see the below error in the log). Any p...

Annotations on a JFreeChart Pie Chart

Specifically I am looking to add text annotations to specific locations to a JFreeChart that is being output to a png file for web use. Can/how do annotations get added to pie charts. I have been able to successfully add annotations to XYPlots, but don't know how to overlay or add one to a PiePlot. My full task is to use the PiePlot to ...

CRM Dynamics 4.0 upload failure

I have a problem when i click on the button "Join" in annotation interface only. This is the context: in policies an user can't modify an annotation if is not the creator. The user1 create an annotation. The user 2 open this annotation and decide to add an attachment file to the annotation. Normally an custom message error appear, but...

@parameters in Junit 4

Can I have more than one method with @Parameters in junit test class which is running with Parameterized class ? @RunWith(value = Parameterized.class) public class JunitTest6 { private String str; public JunitTest6(String region, String coverageKind, String majorClass, Integer vehicleAge, BigDecimal factor) { this.str = reg...

how to make a composite primary key (java persistence annotation)

how to make it so that the table user_roles defines the two columns (userID, roleID) as a composite primary key. should be easy, just can't remember/find. in userdao @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = "user_roles") public List<RoleDAO> getRoles() { return roles; } @Id @GeneratedValue(strategy = ...

The equivalent of <generator class="native"></generator> using MySQL and Hibernate3 annotations

Starting a new project I'd like to use Hibernate annotations with MySQL instead of the configuration files I've used so far. And I can't seem to find the equivalent of: <id name="id" type="long" > <generator class="native"></generator> </id> I tried using: @Id @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "nativ...

Which is Better? Enterprise Library 4.x Validation or .NET 3.5 SP1 Data Annotation Validation

I am in the process of designing an enterprise application from the ground up. I am trying to decide between using the Enterprise Library Validation App block or using the Dynamic data Data annotation for my Business Objects Validation. They both seem to be similar in that the validation rules are decorated on the object properties as ...

Running hibernate tool annotation generation without the "catalog" attribute

when i run my hibernate tools it reads from the db and create java classes for each tables, and a java class for composite primary keys. that's great. the problem is this line @Table(name="tst_feature" ,catalog="tstdb" ) while the table name is required, the "catalog" attribute is not required. sometimes i want to use "tstdb", so...

How to Unit Test Data Annotation Validators

I'm implementing the Data Validation Validators as shown here: http://www.asp.net/learn/mvc/tutorial-39-cs.aspx This works great at runtime, but how can I Unit Test to verify if I say attribute [StringLength(10)], an error is retured? Regards. ...

Annotate images using tools built into OS X

I want to overlay text on images on OS X, preferably without installing additional software, so that, as a sysadmin, I can know at a glance that machines are up-to-date, in a way that is easily scriptable and easily modifiable, and can run without GUI access. [Being able to overlay images or apply color-changing effects would be a bonus...

Error drawing text on NSImage in PyObjC

I'm trying to overlay an image with some text using PyObjC, while striving to answer my question, "Annotate images using tools built into OS X". By referencing CocoaMagic, a RubyObjC replacement for RMagick, I've come up with this: #!/usr/bin/env python from AppKit import * source_image = "/Library/Desktop Pictures/Nature/Aurora.jpg"...

Spring 2 Hibernate Annotation

Hi Gurus, I am setting up Hibernate Annotation (User JPA for mapping) with Spring. (i.e. AnnotationSessionFactoryBean) I have a few questions Do I need a hibernate.cfg.xml for mapping? From the example http://www.zabada.com/tutorials/hibernate-and-jpa-with-spring-example.php, it seems you need to do AOP, do you really need that? I sa...

Clone a Table's definition with Hibernate (hbm2ddl)

In my hibernate application there is annotation driven object: AuditEvent. Its very simple and has no foreign key relationships. I archive old entries in this table by moving them to another table OldAuditEvent, which is a clone of the AuditEvent table. Right now we generate the DDL for the entire application using hbm2ddl (on our a...