I use Hibernate in a storefinder application.
For the proximity search in SQL I use the haversine formula. Because this is a bit messy SQL I created a named SQL query in my .hbm.xml File for this.
SELECT
location.*,
( 3959 * acos( cos( radians(7.4481481) ) *
cos( radians( X(location.coordinates) ) ) *
cos( radians( ...
hi expert, i'm new for web application, previously I did mobile app, now start doing web app, I'm intermediate for java,jsp,servlet, and plan to learn hibernate, spring, struts, ejb, which one i should learn first and where to start, bit confusing
thanks in advance
...
Hi,
I have to show Employee and his Project in dropdown to employee in the right ride of tabular format. In the top i need to show number of records. So, I am doing two queries, one for retrieving count and another for retrieving employee and his project.finally, the total count comes employee*project count.
If an employee has 3 proj...
I am writing a simple application (Spring + Hibernate + PostgreSql db). I am just trying to construct a sample object and persist in db.
I run a simple java class main method where i have loaded the applicationContext and have got reference to the service class as below
TestService srv = (TestService)factory.getBean("testService");
...
I have few tables like Country,state city which has static data. User do not enter any data in this data. I create pojo for Country, State, City. There are few pojo which has mapping with static data. My requirement is that whenever any request comes to Hibernate for Country (21), it do not hit database but return data from cache . Is th...
I have an application which uses Spring 2.5 and Hibernate 3.
There's a web application with a presentation layer, a servive layer and a DAO layer, as well as some Quartz jobs sharing the same service and DAO layers.
Transactions are initialized in different layers with @Transactional annotations, like this:
It led me to a problem ...
Hello all
I use nhibernate to access a mysql database, and I have many -winforms- forms using databinding to modify properties of those objects. There are many –nhibernate- objects created/deleted also during the time those forms are used.
I need to implement a "Cancel" button on those forms.
I can defer the creation/deletion of objec...
I have moved a group of tables to hsqldb for faster performance, however there are a few residual Many to 1 associations between the hsqldb tables and Oracle tables. Is it possible to configure hibernate to manage this type of association? Currently i'm using two persistence units, one for Oracle and the other HSQLDB.
...
I tried
@ManyToMany(cascade = CascadeType.ALL)
Map<String, Double> data = new HashMap<String, Double>();
but it produces the error :
org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class: com.company.Klass.data[java.lang.Double]
at org.hibernate.cfg.annotations.CollectionBinder.bindManyTo...
Can we have more than one JPA persistence units pointing to same database, in different Java projects and deployed on the server at the same time? By same time I mean, not deployed at the same second but deployed together. I am using a hsqldb database.
I am having a client-server model for my project. I have one single unified database ...
I am working on converting a legacy system to use hibernate (version 3.3.x) instead of using hand crafted SQL. I have run in to some problems mapping my datamodel that pertians to composite keys. I've created a solution I think works, but I am not overly fond of it. Hence, I would like to see how the diagram below could/should be mapped ...
I am using NetBeans 6.5.1 and Hibernate 3.2.5.
I stepped through this tutorial by using a different, existing database (Oracle 10g XE). The creation of the config file works fine, as well as the creation of the HibernateUtil.java class. The tutorial then wants me to run the reverse engeneering wizard, but this wizard does not exist. Ins...
Hi,
I am looking for some advice on what the best approach to a hibernate Criteria query is. I have been looking around for a while and can't decide if I should follow an approach of left Joins and searching for and ID or using the Query By Example API (I haven't found any good tutorials for this yet so if anyone has any suggestions it...
One of the properties in my entity is mapped to bpchar (BLANK PADDED CHAR) string.
@NotNull
@Column(name = "property", columnDefinition = "bpchar")
private String property;
When I save entity and load back, then my property is padded with spaces, that is correct from the database point of view.
But I want to work in code with trimmed...
I've encountered a problem I don't really understand - unless a method working with the DAO is annotated as @Transactional, the underlying database doesn't get updated. My app runs on JPA/Hibernate, Spring and Wicket. Why is that?
DAO:
@Repository(value = "userDao")
public class UserDaoJpa implements UserDao {
@PersistenceContext
...
My application runs on JPA/Hibernate, Spring and Wicket. I'm trying to convert our ORM from XML files to JPA annotations. The annotated model looks like this:
@Entity
@Table(name = "APP_USER")
public class User extends BaseObject {
private Long id;
private String firstName;
private String lastName;
private String email;
...
Is it possible to configure Hiberate/NHibernate not to use the default constructor to create objects when reading from the database?
When Hibernate reads 10 customers from a table, it creates 10 Customer objects. It does this by
Customer c = new Customer();
Can I tell Hibernate to do the following instead:
Customer c = ACertainStati...
hi,
I have a table CompanyList in my Oracle database :
CMP_ID INTEGER -- ID of company
CMP_NAME VARCHAR2 -- name of company
USR_ID INTEGER -- Foreign key to the USERS table
i have my Spring 3 MVC app all configured using annotations, my POJOs as well , my DAO objects (CompanyDao) using hibernate to retrieve for exemple a list of comp...
I'm getting a LazyInitializationException trying to test my DAO methods using the tool stack defined in the title. My understanding is that my test must be running outside the hibernate session, or it has been closed before I try to read children objects from my DAO. From reading the documentation, I understood that using the @Transact...
Using Hibernate how would you design and implement a search criteria page (which has multiple editable/selectable fields/drop-downs as search criteria) such that queries shouldn't clutter data accessor code. I mean no query-string concatenation based on conditionals and ultimately all the queries should go in a separate xml file. I've do...