I'm struggling to understand my error in an HQL query:
public List<Pats> getIds(List<String> patIds) {
Session session = getSession();
String hql = "from OurPats where patId = any (:patIds)";
// String hql = "from OurPats where patId in (:patIds)";
return session.createQuery(hql).setParameterList("patIds", patIds).list()...
I'm looking into a problem, where there are two "parent" classes, P and Q that cascade all-delete-orphan to a "child" class, C. My intuition in Hibernate tells this is really a bad idea and I am getting an error message that probably confirms this when the code deletes an instance of P (i.e. session.delete(myP); ):
"deleted object would...
I have inherited a bit of Java code that uses Hibernate. Some of the people using this code are now reporting that they are getting NullPointerExceptions all over the place.
I've been able to track this down and found that when we execute a query that pulls a list of objects from the database, that has a list of objects (that get pul...
Hi,
I am stuck at this problem. The code looks ok to me(obviously I am missing something. The question is what it is?)
I have a Project class
def class project{
...
Manager manager
}
This is Person and Manager class definition
def class Person{
String firstName
String lastName
}
def class Manager extends Person{
...
Hi All,
I have a several questions about hibernate.
In many questions here in stackoverflow, several people are saying that hibernate is not a good choise for very complex databases. If we have very complex database, hibernate is not the right choice. It better suits for green field projects, but it is not so good for complex legacy ...
I have a IDEA project using maven2.
I want to use hibernate + mysql, what dependancies do I need?
...
I can't seem to find an example of hibernate properties for mysql.
Is there a link that has an example?
I have one for hsql:
<!-- Hibernate SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
...
In my User class, I'm trying to add the symbols @id and @column.
I'm getting a compile error:
cannot find symbol class id/column.
I'm using IDEA.
In the docs, I don't see any reference for @Id and @Column: http://docs.jboss.org/hibernate/stable/annotations/api/
I have this in my pom.xml:
<dependencies>
<dependency>
...
Which maven repository has the latest hibernate core 3.5?
I have repository.jboss.com/maven2 and it only shows version 3.1rc2.
The latest is suppose to have hibernate annotations in the core .jar I believe, mine doesn't.
...
background: I am using geronimo + hibernate + spring. Just using the JPA api's on an EJB backend that contains no servlets, no web.xml.
I've been working on this for literally 41 days and have tried all types of combinations so now I'm asking on StackOverflow for help. Please bare with me I have not slept.
I have a geronimo managed...
My app-config.xml looks like:
<!-- Hibernate SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<!--<property name="configL...
For a rich domain driven design I want to use Guice dependency injection on JPA/Hibernate entity beans. I am looking for a similar solution as the Spring @configurable annotation for non-Spring beans.
Does anybody know of a library? Any code examples?
...
I have two entities: A and B. From the A's side relationship is many to one where many A refer to one B and from the B's side this is one to many, where one B could have many A. Both mappings have cascade ="all".
If I try to delete A, since cascade is enabled on many to one, hibernate will try to delete B, but since one to many on B ha...
My homecontroller has a UserService object that gets wired using spring correctly (it renders the index page just fine using a method no UserService).
Now I setup hibernate, so inside UserService I have a UserDao object that I am trying to wire using spring.
@Service
public class UserServiceImpl implements UserService{
UserDao use...
I want to inquire about what actually the flush method does in the following case:
for (int i = 0; i < myList.size(); i++) {
Car c = new Car( car.get(i).getId(),car.get(i).getName() );
getCurrentSession().save(c);
if (i % 20 == 0)
getCurrentSession().flush();
}
Does this means that after the iteration 20, the cache...
I want some of mycoulmns in the JPA entity to take values from database during inserts/updates, i.e from Oracle sys_context, I believe JPA temporal annotation includes database generated timestamps during insert/updates, Is there any way I could create a custom annotation somewhat simailar to this or provide some default values during in...
A little background: I'm using Spring and Hibernate to create a really simple domain/dao/service structure. I'm also using Autowiring to inject all my beans into their happy places.
While refactoring, I recently got the all-too-popular error message "could not initialize proxy - no Session" when trying to access a FetchType.LAZY prope...
My app-config.xml has a definition for my UserDao bean:
<bean id="userDao" class="com.blah.core.db.hibernate.UserDaoImpl">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
I have my component scanning:
<context:component-scan base-package="com.blah" />
My index action in my HomeController works fine (it ...
Little confused, is 'driverclassname' and 'hibernate.dialect' both referring to the mysql driver?
What should I be using? Is the connectorJ the one I should use?
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
...
Goal
Invoke a CREATE TEMPORARY TABLE statement in Hibernate without using native SQL. That means using HQL or Hibernate APIs only.
Save objects to the temporary table.
Invoke a stored procedure which makes use of existing tables and the temporary table.
DROP the temporary table when finished. (I know it's not necessary, but I think it'...