Hello,
I'm using Hibernate second level cache in my application, for certain business reason I can't change the entity annotation any more.
In my project, apart from changing the Database from Hibernate, there exist also other native SQL that do not go through Hibernate. Therefore, the Hibernate second-level cache data could be stale a...
Hibernate persistence class:
@Entity
public class A {
@OneToMany(mappedBy = "a")
private Set<B> bSet = new HashSet<B>();
@Basic
private boolean DELETED;
}
Class B also have a DELETED property. How can we process DELETED property during join automatically, for select only not deleted entities.
May be with hel...
I just start integrate Hibernate Search with my hibernate application. The data is indexed by using Hibernate Session everytime i start the server.
FullTextSession fullTextSession = Search.getFullTextSession(session);
Transaction tx = fullTextSession.beginTransaction();
List books = session.createQuery("from Book as book").list();
for...
I'm using a convention of prefixing field names with an underscore. When I generate annotate entity classes with such fields I am stuck to using the underscore-prefixed property names in queries. I want to avoid that, and be able to do:
@Entity
public class Container {
private String _value;
}
// in a lookup method
executeQuery("f...
To make it clear and easy, I have two projects:
1. An Entity project where there are all the entity classes in this project.
2. An project that contains a main() function to run the application, My ehcache.xml is placed in the class path of this project.
My problem is:
I can change the defaultCache element of ehcache.xml and I can see c...
For a parent-child entity relationship, when (and why) would you use a DAO interface for only the parent and when would you make also make DAO for the children? To me, it makes sense to only make a DAO for the parent if the Children MUST belong to a parent and should not exist as orphans.
So if I wanted to delete a Child, I would modif...
I am developing a transactional application in .NET and would like to get some input on how to properly encapsulate database access so that:
I don't have connection strings all
over the place
Multiple calls to the same stored
procedure from different functions
or WORSE, multiple stored
procedures that are different by a
single column
...
I'm having trouble getting a hibernate select to return a correctly populated object graph, when the select contains joins across many collections.
Eg:
String sql = "select distinct changeset " +
"from Changeset changeset " +
"join fetch changeset.changeEntries as changeEntry " +
"join fetch changeEntry.repositoryEntity as re...
I have an application that needs to support a multilingual interface, five languages to be exact. For the main part of the interface the standard ResourceBundle approach can be used to handle this.
However, the database contains numerous tables whose elements contain human readable names, descriptions, abstracts etc. It needs to be pos...
I have been playing with some LINQ ORM (LINQ directly to SQL) and I have to admit I like its expressive powers . For small utility-like apps, It also works quite fast: dropping a SQL server on some surface and you're set to linq away.
For larger apps however, the DAL never was that big of an issue to me to setup, nor maintain, and more...
I have a class I am not sure how to annotate properly.
My goal for Holder::data:
List should maintain order not by comparator but by the natural ordering of the elements in the array. (Which can be an ndx column if that is helpful.)
Holder will have the only reference to data, so Cascade all is probably applicable as well.
I am al...
I am using Hibernate 3 +Mysql 5.1 and after 98 insertion i am getting this Exception :
com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Data source rejected establishment of connection, message from server: "Too many connections"
My hibernate.cfg.xml file is :
com.mysql.jdbc.Driver
jdbc:mysql://localhos...
How is a blob column annotated in Hibernate?
So far I have a class that has:
@Column( name = "FILEIMAGE" )
private byte[ ] fileimage ;
//
public byte[ ] getFileimage ( ) { return this.fileimage ; }
public void setFilename ( String filename ) { this.filename = filename ; }
...
does anyone know how to prevent hibernate from loading a collection or many-to-one assocation?
i have a use case where i need to load an object, but the calling program can determine whether certain properties are loaded or not. the same goes for part of a collections: certain rows have to be fetched, others not.
domain classes:
publi...
We have an extensive class hierarchy (using the joined-subclass model) where the base class has a Long primary key generated from a sequence in the DB.
We are working on transitioning to a GUID primary key, but wish to retain the old primary key (both in old and newly created content) for legacy apps. While the implementation seems f...
My web application is using Java, Hibernate's JPA implementation (EntityManager) and Spring. What are my logger choices and what would you recommend. Ideally the configuration would be simple (one config file for Hibernate, Spring and my code).
...
I have the following class
class MCustomer : DomanEntity
{
public MCustomer( )
{
}
public virtual iCustomerEntity CustomerDetials {get;set;}
public virtual SolicitationPreferences SolicitationPreferences
{
get;
set;
}
}
public interface iCustomerEntity
{
Contact ...
I have a simple question about usage of Hibernate. I keep seeing people using JPA annotations in one of two ways by annotating the fields of a class and also by annotating the get method on the corresponding beans.
My question is as follows: Is there a difference between annotating fields and bean methods with JPA annoations such as @I...
I am running JUnit tests using in memory HSQLDB. Let's say I have a method that inserts some values to the DB and I am checking if the method inserted the values correctly. Note that order of the insertion is not important.
@Test
public void should_insert_correctly() {
MyEntity[] expectedEntities = new MyEntity[2];
// init expec...
From my sql log file, I think the QueryCache's physical properties are configured by the element:
<defaultCache
maxElementsInMemory="0"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="false"
memoryStoreEvicti...