Hi i an using Hibernate tool with eclipse ganymede 3.4.1 . Now when i create the .hbm.xml file using the code generation of Hibernate tool,it is automatically creating a composite key.
I need a mapping something like :
<id name="id" type="java.lang.Integer">
<column name="id" />
</id>
<key-pro...
Is it ok to take it from Glassfish project ( glassfish-persistence-api) or may be there is a Hibernate jar?
...
Hi everybody!
Imagine you are developing a Java EE app using Hibernate and JBoss. You have a running server that has some important data on it. You release the next version of the app once in a while (1-2 weeks) and they have a bunch of changes in the persistence layer:
New entities
Removed entities
Attribute type changes
Attribute na...
Hi all,
I've been wrestling with this problem for a while, and don't see a solution. Hope anyone can help me.
I have a HibernateTransactionManager configured. However, I see the following message in the log file:
DEBUG [http-8080-1] AnnotationTransactionAttributeSource.getTransactionAttribute(107) | Adding transactional method [cashIn...
We host a service (servlet running on jboss), which receives something like 5-6 requests per second. Every request needs to connect to mysql through hibernate. Most of our requests do selects, with an insert/update every 5th/6th request. The hibernate mysql connection gets timed out after mysql connection time out period (8 hours). Even...
I have configured two persistence units in my JPA/Hibernate configuration. Now i need to execute different import.sql for each persistence unit. How can I specify which import.sql should be executed for each persistence unit? According Hibernate to documentation, I should place import.sql in classpath. If I do that, import.sql is execute...
I have two related tables, MANY and ONE. An integer ONE_ID column on the MANY table formalises a many-to-one relationship.
I want to map to Many and One domain objects and to have Hibernate generate the DDL including a foreign key constraint on MANY.ONE_ID. But I want a simple property getter and setter pair ("int getOneId() / void setO...
Hi
I am new to hibernate and would require a clarification for the below problem.
My main application has some existing tables which i want to use for an optional feature.
Now i need to retrieve data from one existing table and process that data.
Do i need to write a seperate POJO for this table ? I want only 2 columns of these table....
In my specific case, I am making use of a discriminator column strategy. This means that my JPA implementation (Hibernate) creates a users table with a special DTYPE column. This column contains the class name of the entity. For example, my users table can have subclasses of TrialUser and PayingUser. These class names would be in the DTY...
I am facing an issue when am getting the EntityManagerFactory from JPA from the following code in weblogic StartUp Class
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("testEJBPU");
logger.info("Created EntityManagerFactory");
Context ctx = new InitialContext();
ctx.rebind("testEJBPU", emf...
Given the mapped hibernate class:
@Entity
public class MyTestClass {
/* id and stuff */
private Integer aValue;
private Integer bValue;
}
you can do the following with HQL:
Query query
= getCurrentSession().createQuery("select aValue * bValue from MyTestClass");
List<Double> resultList = query.list;
and get the calculated...
Is there any truly practical way to avoid using DTOs, when passing data through Hibernate-backed transactional service methods? In other words, are DTOs the only non-hacky solution to avoiding lazy initialization problems?
I think the two popular alternatives to DTOs and the reasons I don't really like them are:
Open Session in View p...
In order to generate the next SQL code:
create table users (
user_name varchar(15) not null primary key,
user_pass varchar(15) not null);
create table user_roles(
username varchar(15) not null,
role_name varchar(15) not null,
primary key(usernmae, rolename)
);
You can use code such as:
<?xml version="1.0"?>
...
I'm trying to replicate this query from MySQL to HQL:
*UPDATE users u, mines m SET u.mana = u.mana + COALESCE((SELECT SUM(m.mana_rate) FROM mines m WHERE m.user_id = u.id), 0)*
Simply doing this in HQL:
update User u set u.mana = u.mana + (select coalesce(sum(m.manaRate), 0) from Mine m where m.userId = u.id)
Gives following error:
Exc...
I'm trying to run hibernate tools in an ant build to generate ddl from my JPA annotations. Ant dies on the taskdef tag. I've tried with ant 1.7, 1.6.5, and 1.6 to no avail. I've tried both in eclipse and outside. I've tried including all the hbn jars in the hibernate-tools path and not. Note that I based my build file on this post:
...
How do I make/develop Hibernate caching?
...
A problem that I often face with Hibernate is having a list (call it listA) of objects that I want to persist against an entity (myEntity) but having to first compare them to the existing list on the entity and delete those that aren't in listA.
The simple way to do this is to clear the list on the Entity and just add all of listA to th...
I'm new to hibernate, as you'll soon see. I apologize if this question has an easy answer, but I'm just not familiar enough with all of the terminology to find it easily.
Let's say I have a base class "A" and one subclass "B" that I'm mapping with Hibernate, perhaps using the table per subclass strategy. The base class is not abstract...
How far does the spring framework go with transaction handling? My reading of the book "Spring In Action" suggestions with its examples that you create DAO methods that don't worry about Session and Transaction management fairly simply by setting up a session factory and transaction template in XML and then wiring them into your DAO. Spr...
I have an independent study next semester and would like it to be something that applies to future job prospects. I've interned at a company for the passed several years that uses Spring, Hibernate, and ServiceMix. I'd like to learn these technologies during my independent study so I can hit the ground running if I get hired there. Does ...