What exactly does setting the length on a column do in JPA?
@Column(name = "middle_name", nullable = false, length = 32)
public String getMiddleName() {
return this.middleName;
}
I understand that you can use the annotations to generate the database schema (DDL) based on the entity objects, but does length do any sort of check or ...
I'm looking for a tool with which I can annotate source code.
I have some 3rd party source code (JavaScript) I need to understand and I don't want to change it (add inline comments) so that
line numbers can stay intact (for communication with others),
I can avoid accidentally changing something and
my annotations stand out compare...
I have a series of Ruby methods andI would like to dump their return values out to a formatted report. However, I'd also like to annotate these results (i.e. with descriptions of what the value is), and I was wondering if I could use the existing comments on each method to do this annotating?
So I guess what I want to do is output the r...
Hi,
I am creating entities that are the same for two different tables. In order do table mappings etc. different for the two entities but only have the rest of the code in one place - an abstract superclass. The best thing would be to be able to annotate generic stuff such as column names (since the will be identical) in the super clas...
What are some good java interview questions and answers regarding generics and annotations?
...
Hi,
I have a table which uses two columns to represent its primary key, a transaction id and then the sequence number.
I tried what was recommended http://docs.jboss.org/hibernate/stable/annotations/reference/en/html_single/#entity-mapping in section 2.2.3.2.2, but when I used the Hibernate session to commit this Entity object, it leav...
The problem is that I need to create in runtime a class like this:
public class Foo {
@Bar int value0;
@Bar int value1;
@Bar int value2;
....
}
with number of fields being decided at runtime.
I was looking at Javassist, and there you can create a new class, and add fields to it, but I haven't found a way to annotate those field...
With an XML configured Spring bean factory, I can easily instantiate multiple instances of the same class with different parameters. How can I do the same with annotations? I would like something like this:
@Component(firstName=”joe”, lastName=”smith)
@Component(firstName=”mary”, lastName=”Williams”)
public class Person { /* blah blah *...
Using hibernate with annotations, i want a one-many relationship to be sorted by the 'created' field on the 'many' table.
So far i've got this, which always ends up in a random order:
// The notes
@OneToMany
@JoinColumn(name="task_id")
Set<TaskNote> notes;
public Set<TaskNote> getNotes() {return notes;}
public void setNotes(Set<TaskNo...
Hello,
I just started using XStream Annotations, and I am trying to figure out how to associate the annotations with the XStream object. From the documentation, it seems like this is the accepted method:
XStream xstream = new XStream(new DomDriver());
xstream.processAnnotations(AnnotatedClass.class);
My problem with this is that Ecl...
Mapping an EMF model via Teneo/Hibernate works great. The default of mapping a Java String to MySQL results in the creation of a VARCHAR(255) column. This is too small for some entries.
I found out that the annotation @Column(length=4096) is what should help me out. But I cannot figure out where to append it. I tried the interface and i...
I am testing my Hibernate DAOs with Spring and JUnit.
I would like each test method to start with a pre-populated DB, i.e. the Java objects have been saved in the DB, in a Hibernate transaction that has already been committed. How can I do this?
With @After and @Before, methods execute in the same Hibernate transaction as the methods d...
I can't get spring annotations to work at all, I'm just trying to get the simplest thing to work...
.../mycontext/something -> invokes method:
@RequestMapping(value = "/something")
@ResponseBody
public String helloWorld() {
System.out.println("hello world");
return "Hello World";
}
My main problem is no matter how hard I try,...
I'm building application using GWT and one of the requirements is to index a text and then allow users to add comments/notes/sticky notes to that text. I found library called Annotation, which is pretty good but then I will have to have separate version of the documents for every user, that is not acceptable for us. We need to have only ...
I want to update pin callout (popup) subtitle either realtime, when I receive some new info from server, or at least when callout opens. So far it looks like pin + callout are created only once at...
- (MKAnnotationView *)mapView:(MKMapView *)aMapView
viewForAnnotation:(id <MKAnnotation>)annotation
...and then used as-is as l...
I've seen some code in a project recently where some fields in a couple classes have been using the default access modifier without good reason to. It almost looks like a case of "oops, forgot to make these private". Since the classes are used almost exclusively outside of the package they are defined in, the fields are not visible fro...
Hi all,
I need to create a relation in Hibernate, linking three tables: Survey, User and Group.
The Survey can be visible to a User or to a Group, and a Group is form of several Users.
My idea was to create a superclass for User and Group, and create a ManyToMany relationship between that superclass and Survey.
My problem is that Grou...
Hello all,
At work we are using several tools to capture several metrics (mostly cyclomatic complexity and LCOM). We use those to get warning flags and to guide pre-emptive refactoring efforts. It's been very beneficial in increasing code quality.
However, the process is not tied to the build process. It is conducted separately. Moreo...
How do you get client side validation on two properties such as the classic password confirm password scenario.
I'm using a metadata class based on EF mapping to my DB table, heres the code.
The commented out attributes on my class will get me server side validation but not client side.
[MetadataType(typeof(MemberMD))]
public partial ...
Hi,
I have all my annotations(as nsdictionnaries) in an array , and the users add them one by one by tapping on an icon. I want to make it impossible to add more annotations after adding 10 annotations (there is 110).
Is it here i have to make something?:
-(IBAction) plusButtonTapped: (id) sender {
NSDictionary *poiDict = [poiArray ob...