I can't seem to get hibernate to use c3p0 for connection pooling, it says
12:30:35,038 INFO DriverManagerConnectionProvider:64 - Using Hibernate built-in connection pool (not for production use!)
12:30:35,038 INFO DriverManagerConnectionProvider:65 - Hibernate connection pool size: 20
Hibernate Config:
<hibernate-configuration>
<...
I have a spring 2.5 + hibernate webapp with transaction annotations and everything works fine.
I now want to add a fairly basic aspect with 'around' advice and apply it to my service layer (which is transactional). I am doing this using aspectj annotations and placed
<aop:aspectj-autoproxy/>
in my spring xml.
Spring transactional ...
With hibernate, I want to be able to support multiple databases, one for read and one for writes.
Is this possible? Is the only way to create 2 separate session objects?
...
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingResources">
<list>
<value>product.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.HSQ...
I'm trying to use Hibernate with JPA/EntityManager to do database activities
Right now I'm getting this error and I have no idea what it means.
Before I had this code and it works fine.
public class JdbcProductDao extends Dao implements ProductDao {
/** Logger for this class and subclasses */
protected final Log logger = LogFactory.g...
create table A (id, col_A, col_B, col_C)
id = unique id
for every row being persisted either col_A or col_B will have a valid value, but both columns will not have a value for each persisted row at the same time.
e.g.
insert into A (id, col_A, col_C) values (1, "a", "c")
insert into A (id, col_B, col_C) values (1, "b", "c")
insert i...
Im working with a legacy database and an application written for Apple WebObjects and migrating that to Hibernate.
I'm trying to map a many to one relationship and also its join attribute. But Hibernate gives "Repeated column in mapping" error if i try to do that, unless i make one of it readonly.
But the application written in WebOb...
I have been trying to figure out a way to create shared Hibernate session service on Tomcat 6.
basically, I need to have this service: 1. to be re-deployable (which exclude the JNDI service); 2. all the web applications can share the same Hibernate sessions (cache). The Tomcat class loading mechanism seems make sharing the db sessions im...
I'm getting this error from my EntityManager when I call the refresh function.
public void saveProduct(Product product) {
entityManager.refresh(product);
}
I heard this could be a bug with Spring/Hibernate, however I'm not sure how to get around this.
Edit:
the error is
java.lang.IllegalArgumentException: Entity not managed
or...
I have a single table which is generated from two jpa entities (inheritance). So we have a DTYPE column generated in the database table which has entity name has values.
How do I write a jpa query to fetch data for any given entity. i.e DTYPE = 'A'?
I just tried using DTYPE in jpa query but as expected I got an error "Could not resolve...
Could anyone hint me how to configure SwarmCache for Hibernate to work in cluster (distributed cache)? Probably there are some other alternatives (please, don't suggest JBoss Cache)?
...
I gonna write several intergration tests which will test interatcion with db.
For each test I need to have a certain snapshot of db. Each db snapshot saved in .sql file.
What I want is to execute certain script file in certain test method, like this:
@Test
public void test_stuff(){
executeScript(finame.sql);
... testing logic ......
I'm using Hibernate annotations and have a VERY basic data object:
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
public class State implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
private String stateCode;
private String stateFullName;
...
It appears that the Hibernate NotEmpty annotation does not result in an error for strings filled with whitespace (" "). Only works for nulls or empty strings (ie: new String()). Is there a workaround/fix for this?
...
I'm having this strange problem where my merge() or my persist() functions are not being reflected in the database.
My JdbcProductDao.java:
@Repository("productDao")
public class JdbcProductDao implements ProductDao {
@PersistenceContext
private EntityManager entityManager;
public JdbcProductDao(){
}
public Produc...
I'm observing a very strange behaviour with an entity class and loading an object of this class whith JPA (hibernate entitymanager 3.3.1.ga). The Class has a (embedded) field, that is initialized in the declaration. The setter of the field implements a null check (i.e. would throw an exception when a null value is set).
...
@Entity
publ...
I've already set
<property name="show_sql">false</property>
& disable all messages in log4j.properties
But Hibernate shit to console with all queries & statements.
...
Out of the blue I started getting “IllegalArgumentException: argument type mismatch” in hibernate. The hibernate entity was working for quite some time and svn logs confirm the code to be intact.
What might be the case?
Here’s part of the exception
Jan 16, 2010 10:47:09 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE...
How do I setup NhProf for Hibernate?
...
Hi,
I want to put my system to either sleep or hibernate, two different options.
How would I do this with API's, I don't really want to use Process, and that doesn't allow me to choose what method I want for this action.
Thanks.
...