I'm using Spring's @Configuration, and I noticed that a @Bean does not get registered using JMX.
The bean is wired as
@Bean
protected CountingHttpInterceptor countingHttpInterceptor() {
return new CountingHttpInterceptor();
}
and the class definition is
@ManagedResource
public class CountingHttpInterceptor implements HttpReque...
I'm using Hibernate 3.5.2-FINAL with annotations to specify my persistence mappings. I'm struggling with modelling a relationship between an Application and a set of Platforms. Each application is available for a set of platforms.
From all the reading and searching I've done, I think I need to have the platform enum class be persisted a...
Little confused, the basic spring mvc app has this:
app-config.xml
<context:component-scan base-package="org.springframework.samples.mvc.basic" />
and the mvc-config.xml has:
<!-- Configures the @Controller programming model -->
<mvc:annotation-driven />
Do you really need both?
for component-scan, does this mean if I don't p...
What would be the way to have java-style annotations in Ruby and in C++?
(Optionally, perhaps it is a matter of taste)
Are java-style annotations worth to be used, so you would recomend using them in other languages, if possible?
...
I am using the iphone sdk and trying to use a custom image for my AnnotationView on my MKMapView. My approach works fine for another screen in my app, but for the problematic one, I see the image in the simulator but not on the device. I basically create a custom view like this:
@implementation CustomAnnotationView
- (id) initWithAnn...
Is it possible to restrict only annotations into a List?
So let's say I have two annotations:
(1) Foo.class
(2) Bar.class
When declaring a List, I only want to allow the inclusion of annotations but everything else would result in a compilation error:
List<Something> list = new ArrayList<Something>();
list.add(Foo.class);
list.add(Ba...
Like so : a class has a method called sayHello() . When a instance of the class call the sayHello(), a method in another class is called automatic before the sayHello() is called.
the sample code can be like this:
public class Robot{
public static void doSomethingBefore(){
System.out.println("Do something before sayHello");
...
I am trying to create a library which depends heavily on annotating class properties. The properties should be able to be annotated via getters or on the actual underlying fields (ala JPA etc.)
Is there some standard for this? Tons of libraries do this (e.g. Hibernate). Do they all just roll their own implementation and conventions? Is ...
I am working with a FlowDocument in a RichTextBox and I need to find a way of displaying the block hierarchy. I envisage using something like the WPF GroupBox whereby each block element is assigned a border and a non-editable identifying label. The borders will clearly show which block elements are contained within other elements and the...
I am new about attributes. I just try it on my console application.
So how can i validate my person instance below example ?
class Person
{
[StringLength(8,ErrorMessage="Please less then 8 character")]
public string Name { get; set; }
}
...
According to my JPA 2.0 book (and online documentation), I should be able to mix field and property access within a single entity or entity hierarchy. The annotation of @Access on the class specifies the default access. When placed on a field or property getter @Access can specify that the default should be overridden for this field.
...
I am just about starting to work with NHibernate Annotations, Are there any good articles on Annotations with examples to iron out basic doubts.
...
I'm using Java's CodeModel to generate some annotations code. However, I can't find a way to indicate that a parameter's default value should be the empty array, expressed as {}.
Example:
public @interface Example {
Class<?>[] groups() default {};
}
I know I can use JDefinedClass#direct(String) to output raw code, but I would lik...
Hello everyone,
I want to write this piece of code :
@Stateless
public class MyEjb
{
@EJB
private static MyOtherEjbWhichIWantStatic myOtherEjb;
}
It makes sense to me, that I want to inject an EJB in my class, as a static element, for various reason.
Java is not very happy with that unfortunately
com.sun.enterprise.contain...
I have a database that I'm running several applications from. I like to separate the tables by creating a schema for each application. For my newest application I'm using FluentNHibernate. Seems like I have most of the plumbing correct but when I try to query one of my tables it can not find my table. I ran query analyzer and saw the sch...
I wanted to use the JaxB annotation in my class like this:
@XmlRootElement
public class ItemExtension implements Serializable {
But GWT complains when I put it in the client side.
[ERROR] Line 4: The import javax.xml.bind cannot be resolved
[ERROR] Line 14: XmlRootElement cannot be resolved to a type
Is there a workaround...
I am new to hibernate and I am having some trouble with the named query annotation. My code is as follows and is more or less generated by NetBeans
The BasicUser class:
package wmc.model;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Colu...
Here's my problem:
Say I have two entities annotated with JAX-RS annotations:
@XmlRootElement
@Entity
public Person {
private String firstname;
private String lastname;
private Address address;
}
@XmlType
@Entity
public Address {
private String street;
private String city;
}
This will get rendered into:
<person>
<first...
Table Layout:
TABLE ORDER:
id
localizedInfoId
Table OrderLocalizedInfo:
id
localizedInfoId
name
With the following entities:
public class Order {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="id")
private Long id;
@ManyToMany(
targetEntity=OrderLocalizedInfo.class,
cascade...
My current web development tool is Spring 3, I've used Hibernate before, I'm actually quite familiar with it after I have access to the annotations and entities, and the session object. However, this will be my first time needing to actually set it up from scratch.
Currently I have a datasource that I have used for JDBCTemplate, and I ...