I am planing to create an application relying on DB using Hibernate. I will have some similar classes like teacher and student and so on. In DB they will have some fields with similar names. So I wonder If I can create a class Human with annotations for standard fields like Name, SName and so on so to just extend that class in teacher st...
ANY advice would be apprecated. I'm stumped...
Problem
On my laptop, anytime our application tries to load the application-config.xml, I get a java.lang.reflect.MalformedParameterizedTypeException.
The EXACT same code works on my desktop and my coworker's desktop/laptop. But on my laptop it throws this error. Since my laptop and des...
Well,
As I read and try every topic similar without success, I decided to post my own question.
My solution has a console app and a class library for dataaccess. The Nhibernate configuration is inside the appconfig in the console app (which I'm currently using for debug, as I will after make a Web App and migrate all configuration to we...
I am having some kind of classpath problem:
I've put my context.xml files in META-INF/spring/conf/
They can be perfectly found by Spring using classpath:WEB-META/spring/conf/root-context.xml
(root-context.xml references other xml's).
My Hibernate.cfg.xml is on src/main/resources, so it 'should' be on the classpath, however Spring does...
Hello
Let's say I have table foo, table bar, and table zoo.
foo has a member bar and there is a one to one relationship between them.
bar has a list and there is a one to many relationship between them.
the list is not initialized automatically when bar is read (ie it is lazy)
Using hql I would like to get a list of the foo objects wit...
Please suggest which is the better book...
...
Customer class have name property that corresponds to name field in customer table.
Customer class also define the map that use for put the fieldName and fieldValue.
on database customer name define in customer table and fieldvalue define in form table.
now how i can retrieve customer name from customer table and fieldvalue from form ta...
Hi,
I want to avoid serialisation ( in JMS / AMF ) but still persist the field with JPA/Hibernate.
Is the transient modifier my friend ? Are @Transient annotation and the transient modifier related or not a all ?
The java specification precise that a transient field will not be saved to a persistent storage by a system service. But is...
We have found a problem on our application (a select query that join too much tables). The solution of this problem is to set fetch="select" on the <join> tag in our hibernate mapping file.
<subclass extends="...">
<join table="MyTable" fetch="select">
...
</join>
</subclass>
But this mapping is generated by hyberjaxb2. I hav...
Oracle supports a query syntax where a table is joined to an Oracle collection type (Nested table or VARRAY). This semantic can be used instead of the in (1,2,3) syntax in SQL, and allows an array of values to be bound to the query. This can be done using Oracle's JDBC driver.
This type of query is known as a Pickler Fetch. It is much m...
I have a question which I think should be pretty common but I can't find an answer.
I have 2 objects: Group and User. My classes look something like this:
class Group
{
@ManyToMany(fetch = FetchType.EAGER)
List<User> users;
}
class User
{
@ManyToMany(fetch = FetchType.EAGER)
List<Group> groups;
}
Now, when I try to get a Use...
Hi,
I have a package containing annotated entity classes that I import into my web project.
When tomcat deploys the project the entity class that are in the jar are not scanned for annotations. is there a way to tell spring to search for annotated classes inside a jar file? i.e. :
<context:component-scan base-package="{path to jar or...
I am using spring security and have an admin jsp page for editing user details. I want to be able to grant or revoke authorities on this page. The following checkboxes tag works to display a given user's existing authorities:
<form:checkboxes path="authorities" items="${roles}" delimiter="<br />" />
where authorites is an attribute ...
I am using Hibernate over SQL Server for a web application. I was using the "increment" generator class till now and recently ran into ConstraintViolation exceptions.
So, I changed the generator to "identity" and I am getting the following error -
Cannot insert the value NULL into column 'assessment_administration_id', table 'faip....
I am receiving the following Hibernate Exception:
@OneToOne or @ManyToOne on Matchup.awayTeam references an unknown entity: Team
The simplified Matchup class looks like this:
@Entity public class Matchup implements Serializable
{
protected Team awayTeam;
@ManyToOne
@JoinColumn(name="away_team_id")
public Team getAwayTea...
Hi,
I am working with JPA (1.0 or 2.) + hibernate (3.4.0 or 3.6.0) and I have run into a problem with I think caching somewhere. What I do:
Find an object with my JPA class (row in the database with a particular id)
update a boolean flag on the object (tinyint field in the database)
persist the object
grab the entire table from the ...
After calling list() on a Hibernate Query which you expect to just return a list of Foo objects (see example below), how best would you deal with this situation?
Query query = session.createQuery("from Foo");
List list = query.list();
I don't particularly like seeing this:
public List read() { ... }
When I would much prefer:
pub...
I have a Tomcat servlet that incorporates hibernate. It works fine normally. When the servlet starts I initialize hibernate and create a session factory. I then use this session factory to generate sessions when performing various database transactions. So far so good. My problem comes after a long period of inactivity on the s...
If I have an entity called Foo that looks a little like this:
@Entity
public final class Foo {
private int id;
private String name;
...
}
I want to retrieve the names of the Foo objects that have an id greater than 10. If I already have a collection of Foo objects, I could do something like this:
List<Foo> foos = ...
Que...
On a onetomany associations I am attempting to delete all the many associations and see that multiple delete statements are being executed.
// The entities
class Users{
...
public void setPhones(Set<Phone> phones){
this.phones = phones;
}
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER, mappedBy="users", o...