Hi,
Im trying to understand how hibernate works under the hood, how it manages lazy load, transactions, data mappers, unit of work, identity maps, etc.
I wrote a small object model, and im downloading hibernate's source code for debbuging it.
Im kind of lost, is this the best approach? Does documentation on these issues exist out ther...
Is there a way to use Flyweight objects with the hibernating persistence mapping? My data model contains many objects that will be the same. Instead of having a separate instance for each of those same objects I'd like to use the Flyweight Design Pattern and reference always the same physical object. How to achieve this in hibernate?
Bt...
Hi
Can somebody give me a simple example on how to delay validation in hibernate till i commit the transaction.
In oracle for example i can create a table with all the constraints as deferred so that validation takes place at commit time only and not at insert.
However i am currently not using Oracle
...
Hello!
I noticed that hibernate generates different aliases for the same columns each time i try to access the same table:
Hibernate: select person0_.id as id0_0_, person0_.nam as nam0_0_, person0_.fam as fam0_0_, person0_.otc as otc0_0_ from web_db.Person person0_ where person0_.id=?
Hibernate: select person0_.id as id4_0_, person0_.n...
my primary key entity look like below
@GeneratedValue(strategy= GenerationType.TABLE)
private Long id;
when i run, i get error
could not get or update next value;nested exception is org.hibernate.exception.SQLGrammerException:could not get or update next value
but when i just change to
@GeneratedValue
private Long id;
no error...
Ok, i wish to know the correct way to build forms in JSF. I have multidatabase app(user can switch databases during runtime, all databases are build on the same scheme) and now i want to build forms for data input.
I tried build functionalities in NetBeans, where i can generate entity classes from database, but, as far as i understood, ...
when using createCriteria, how to specify SELECT..WHERE.. IN (value1, val2...) ?
...
I have a MySQL table with one of the column type as Date. In my hibernate mapping file I have mapped this column to type java.util.Date. Now in HQL while trying to retrieve objects based on date equality I do not get any results if I set the Date using new Date(). If I normalize the date by setting hours, minutes and seconds to zero I ge...
Hi there,
I'm trying to get my spring DAOs to work but I only get this exception
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'sessionFactory' threw exception; nested exception is org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation...
Hello, I'm designing a data model using Fluent nHibernate and I'm wondering how to visualize entites, relations and stuff for documentation purposes.
This is my first project using Fluent nHibernate. My previous projects were build on Linq2Sql but recently I was a bit annoyed about some L2Q concepts and finally I decided to do a switch ...
I have a products objects which belongs to certain categories i.e. classical many to one relationship.
@Entity
public class Product{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
Long id;
String name;
Double price;
@ManyToOne(fetch = FetchType.LAZY)
Category category;
...
}
@Entity
public class Categ...
My application is trying to use Hibernate annotations. I've gotten the 3.5.0 version of Hibernate installed, but when I try to load my app I get the following exception:
junit.framework.AssertionFailedError: Exception in constructor: testSubscriber (java.lang.NoClassDefFoundError: javax/persistence/spi/ProviderUtil
at java.lang.Clas...
I am building a project in GWT that pulls an rss feed, executes regular expressions on the feed (in javascript using JSNI), and then stores that resulting data on a database where the users can access it.
As of right now, I have been writing all the code in the client-side .java file hoping that I could simply transfer it to the server-...
I have a simple data model in JPA (hibernate) consisting of many to one and one to one relationships similar to this:
town -> state -> governor -> nation -> continent
where town is many to one to state, state is one to one to governor, governor is many to one to nation and nation is many to one to continent.
I would like to fetch a si...
<ehcache>
<cache name="query.ContactInfoList"
maxElementsInMemory="200"
eternal="true"
overflowToDisk="false"
timeToIdleSeconds="300"
timeToLiveSeconds="600"
/>
</ehcache>
public List getContactInfoList(){
hibernateTemplate.setCacheQueries(true);
hibernateTemplate.setQueryCacheRegi...
session.open
insertIntoTODB()
getList()
session.close
session.open()
getList();
sesson.close()
1st leve cache is only bounded in session open and close and for 2nd subsequent session open, getList() will get from DB instead of cache?
...
for first level of cache, what i understand is when we do saveorupdate , we need to call flush() to refresh the cache in order for subsequent select query from DB. So, for application using hibernate, we should not modify records/delete records using DB-GUI without going through hibernate as the select will query wrong result because of ...
1.for 2nd level cache, can only set timeout period but cannot force refresh/clear cache of entity? or putthing annotation @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) like auto refresh/clear the cache each time doing saveorupdate/mergeupdate? what is hibernateTemplate.flush() relate to this?
2. is it good to enable 2n...
Today I faced an interesting issue. I've been having an inheritance hierarchy with Hibernate JPA, with SINGLE_TABLE strategy. Later, I added a superclass to the hierarchy, which defined TABLE_PER_CLASS strategy. The result was that the whole hierarchy stared behaving as TABLE_PER_CLASS. This, of course, seems fair, if we read the @Inheri...
The following JPA column definition generates an "integer" data type by default on all databases (e.g. h2, mysql, postgres)
@Column(name = "type", nullable = false)
@Type(type = "com.mycompany.hibernate.usertype.GenericEnumUserType", parameters = {
@Parameter(name = "enumClass", value = "com.mycompany.model.DegreeType"),
...