Hello guys sorry if the question looks stupid to you.
i have 3 tables currency (id | name) language (id| name | description) transaction (id|amount|languageId | currencyid)
so i want to insert into the transaction but making sure that it doesn't insert unknown language or currency (meaning it shouldn't insert to messagetemplate if there...
Hi all.
I have annotated a String field with @NotEmpty tag.
When I try to persist the entity with this filed's value "", it works fine. Mechanism detects the validation error and raises an InvalidStateException exception notifying the issue.
But when I try to persist the entity with this field's value null, an UndeclaredThrowableExcep...
Summary
A parent can have many children. How do you write a service such that, if after adding a parent there is an error when adding a child, the entire transaction is rolled back. For example, add parent p1, successfully add child c1, then when adding child c2 an error occurs, both p1 and c1 should be rolled back.
Detailed Problem
In...
Hi guys,
I've made a very simple REST controller method with Spring 3.0.0.RC1 that uses hibernate to perform a query. The query takes about ten seconds to complete. I've made this with intent so that I can fire up two requests to my controller.
Then I fire up the two requests, and query in MySQL (my DB backend) "show full processlist",...
Can someone tell me how to configure hibernate (Annotations) with Eclipse?
...
Hiya, I'm sort a newbie when it comes to hibernate so I'm going to try to ask my question as clearly as possible. I wanna execute following query as hibernate query .
<sql-query name="updateINFO">
update
info
set
status_id = 2
where
pid = :i
</sql-query>
Now i is a dyn...
Hi guys,
I read about using
<context:component-scan base-package="tld.mydomain.business">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Service"/>
</context:component-scan>
and annotate my service beans with @Service("myService"), and thought great, I'll do that, since I'm already doi...
Hi. i have a swing desktop application that use a entitymanagerfactory, but when this application is executed many times at the same time, the diferents entity managers have old data that was modified by others and this changes will not visible until the next entitymanagerfactory... how can i sync in anytime the entitymanager with the da...
How do I map an enum with a field in it?
public enum MyEnum{
HIGHSCHOOL ("H"), COLLEGE("C")
private int value;
public MyEnum getInstance(String value){...}
}
@Entity
public class MyEntity {
@Enumerated(...)
private MyEnum eduType;
}
How do I annotate so that values H, C will be persisted in the database? If I keep @Enumerated(EnumTyp...
As shown below, I am accessing a Service layer method inside of another DAO.
(Every DAO in the system is implemented using HibernateDAOSupport class)
I wanted to rollback the transaction when #1 or #2 (commented in the following code) is failed.
But when #2 throws an exception, #1 does not get rolled back and I can see the entries in th...
I have been trying to use the hibernate dialect for SQLite from http://code.google.com/p/hibernate-sqlite/ in a project, but have hit a problem with something like the following...
SQLQuery query = session
.createSQLQuery("select id from collection where collection = (:collection_name);");
query.setParameter("collection_name", col...
hi, i am using hibernate but i want to add an application that is using hibernate. the problem that i am facing is when i want to perform global transaction on that combined application. i am using weblogic as container, now the problem is that hibernate created its own connection, i want that toplink should use that connection only... c...
i want to make a text box like stackoverflow have for the tag at askquestion page where data pop up as we write something.
I want to fetch the tag from the database rather local static data.
In my project i am using jsp servlet hibernate and spring
Please tell me how to do..
thanks in advance
...
Here is my implementation in summary
1) all DAOs implemented using HibernateDAO support/ @Transational annotation is only used in Service layer
2) Use MySQL / HibernateTransactionManager
3) Test using main(String args[]) method (do transactions work using this method? )
Transactions does not get rollbacked and invalid entried can be...
how to select particular field using Criteria ?
...
my hibernate object A has object B, C, and D as properties :
A.getB().getName();
A.getC().getTitle();
now, I want to load A with all its properties without getting a LazyInitializationException.
so, I need to load A's object graph fully.
is there any generic method of retrieving an object's graph in hibernate ?
...
Hi,
I am currently writting a piece of code for retrive data using hibernate with the criteria APi.
I have one class-A
This class have one property CollectionOfB;
This collection collection contain object of another class that is class B.
Class B have one property CollectionOfC;
This collection collection contain object of another cl...
I have an AbstractEntity class as superclass for all my entites that defines an optimistic lock column like this:
@Version
private long lockVersion;
Now I often get OptimisticLockingExceptions on entities, that are only changed in one the mappedBy relations similar to the following:
@OneToMany(mappedBy = Property.PROPERTY_DESCRIPTOR,...
In the hibernate mapping file I use property formula to get any value.
<property name="price" type="double" formula="(select SUM(amount) ...) />
But it allows to get only 1 row. How can I get lisf of rows?
I understand that "property" is not suitable, but it's impossible to add formula to set or list.
Of course I just want to get va...
Hi all,
I have the following beans Task, ServerDetails and ApplicationDetails.
I wish to retrieve all tasks, their server details and application details based on a specific application name.
From the result i expect to be able to retrieve the data in a manner such as:
task.getServers().getApplicationDetails()
In actuality, I get wha...