annotations

Hibernate: Mapping User-Friends relation in Social Networks

It's quite some time that I'm trying to figure out this problem and from googling around many people have similar problems. I'm trying to model a User in a Social Network, using Hibernate, and what is more basic to a social network than to map a friendship relation? Every user in the system should have a list of it's friends and I thoug...

How to get a recursive svn blame report in a single xml file for all non-binary files in a branch?

How can I get a fully recursive svn blame report for all non-binary files in a branch, where the output is in a single file in xml format and includes revision, date, author, filename & path, and the text of the line of the file itself? The entire output needs to be in a single file. It will be executed as part of the build via a CCNet...

Annotating inherited properties for persistence

Assuming I have a class A as follows: class A{ int id; int getId(){}; void setId(int id){}; } And a class B as follows: @Entity @Table(name="B") class B extends A{ string name; @Column(length=20) string getName(){} void setName(){} } How can I annotate the inherited id field from A so that Hibernate/JPA knows ...

auto-detecting components using spring annotations

I've managed to configure to spring to auto-detect my components using the @Autowire annotation. However the problem is that not all the components are being Auto wired. Specifically My DAO's are being bound but my service objects aren't. I have to explicitly create a bean for my service object in the spring xml config file. Any clu...

Is there a library that generates UIs based on metadata declarations like this>>?

Hello, Do you know about a library that allows us to generate UI by just stating that it should be generated? I think there must be a person who have implemented a mechanism allowing us to transform code like this: class Main { @Command int add(int a, int b) { return a+b; } } into, say, a dialog with 2 text fields...

Is there a good reason to configure hibernate with XML rather than via annotations?

I've been using Hibernate for a few years but have only used it with annotations, and by setting the connection parameters in my code. Am I "missing something" by not using the XML files? Are there important capabilities available only in XML? Are there situations or patterns where it makes sense to use the XML? ...

Spring - Annotation Based Controller - RequestMapping based on query string

In Spring annotation-based controller, is it possible to map different query strings using RequestMapping to different methods. for example @RequestMapping("/test.html?day=monday") public void writeMonday() { } @RequestMapping("/test.html?day=tuesday") public void writeTuesday() { } Thanks. ...

Does anyone have a list of all the Visual Studio C# pragma names?

In C++, there was a #pragma to output to the build log. Does one exist for Visual Studio 2005 C# ? And, does anyone know where an actual list of all the #pragma names can be found? ...

Help with annotations

Edit--@Uri correctly pointed out that this was an abuse of annotations; trying to actually create the menu data itself in annotations is just silly. They are good for binding however, I think I'll stick with using them to link the text data to the methods (the @Menu ("File") portion) since it's more explicit and flexible than reflecting...

Cool uses of Attributes or Annotations (CLR or Java)?

What are some cool applications for custom attributes in CLR/C# code that you've done or heard about? Also interesting new uses of the standard attributes is also ok! Edit: Since Java's annotations seems to be the same as CLR's attrbutes, uses of Java annotations is also valid. ...

How to allow the user to add annotations to UI controls in WPF?

WPF document viewing controls that support annotations include FlowDocumentReader and FlowDocumentScrollViewer, as well as controls derived from DocumentViewerBase such as DocumentViewer and FlowDocumentPageViewer. The in-built Annotations support for Document based controls is awesome in WPF I was wondering how would it be possible to...

How do I change the description of input's displayed for an operation defined using a MXBean

I'm using a MXBean to instrument a certain feature, and I have a method that takes in 3 input arguments. By default, on the jconsole, the arguments are displayed as p1, p2, p3 etc. I have @params describing each parameter. How do I make jConsole use those? public class Sample implements SampleMXBean { /** * method 1 * ...

spring not enforcing method security annotations

I'm some what lost as to why spring isn't enforcing the @Secured("ROLE_USER") on my service interface. My controllers are established using annotations. An example of my service Interface public interface MyServiceManager { @Secured("ROLE_USER") public void delete(int cid); @RolesAllowed({"ROLE_USER"}) public Contact...

How do I map a Map from an Entity to a Value with hibernate annotations?

I have Shipment and Product entities. Each shipment consists of any amount of any numbers of products. I.e. a shipment has a field named products which is a java.util.Map where they key is the product being shipped and the value is the number of instances of that product being shipped. How do I map that to a db with hibernate annotation...

Hibernate HQL with list getters

I have a Hibernate entity, with a getter that is mapped as a @OneToMany: @Entity class Parent extends BaseParent { @OneToMany(cascade = {CascadeType.ALL}, mappedBy = "parent") public List<Child> getChildren() { return super.children; } public void setChildren(List<Child> list) { super.children = list; ...

Trouble getting Hibernate Core and Hibernate Annotations using Apache Ivy (but it's also Maven2 related.)

It's a long one! ;-) There are a lot of copy pasted text in this question which makes it look complicated. And to be honest, it's a lot of information! However to an experienced person a lot of it might be unnecessary and easy to skim over. In its essence I'm only wondering why my basic Hibernate Core + Hibernate Annotations test proje...

Overriding line number in generated Java source

Is there any way to override the line numbers in Java (e.g., by using some kind of preprocessor directive)? I am "compiling" a high-level language, down to Java byte code using Janino. I need compiler errors to report the line from the original file, not the generated Java code. C# has the #line directive, and I've successfully exploi...

JUnit before and test

What is the use of a Junit before and Test package in java? how can i use it with netbeans? ...

Where did C#'s attributes come from?

I find C#'s Attributes, Python's Properties too a really nice idea, and I guess their direct ancestor might have come from Java's Annotations, but I'm curious as to where this concept originally came from, anyone has any clues? ...

Commonly reusable annotations or commons annotations?

Are there any commonly usable annotations available? Similar to commons-lang? If not, have you seen any effective use of annontations (not built-in annotations) as part of any open source application development. I remember Mifos was using it for Transaction. Mohan ...