Hello there.
In java application I use hibernate criteria queries,
for example:
Criteria criteria = session.createCriteria(Any.class);
...
List<?> list = criteria.list();
and I definetly know that result list contains only objects of type Any but
I don't know if it's possible to get list of type defined above?
In this case, if I ...
I am trying to test an entity EJB3 with Spring.
The EJB itself does not uses Spring and I would like to keep duplications of the production JPA configuration minimal (ie not duplicating persistence.xml for exemple).
My unit tests seems to work but even though my unit tests should be transactionnal, data is persisted between the various...
Hello
I have a high traffic website and I use hibernate. I also use ehcache to cache some entities and queries which are required to generate the pages.
The problem is "parallel cache misses" and the long explanation is that when the application boots and the cache regions are cold each cache region is being populated many times (inste...
I am trying to execute a query against a MySQL database.
The query is fairly complex it has 5 inner joins, including 1 join to itself and
it returns 3 pieces of information from 2 different tables.
We are using hibernate and till now I have used it for simple queries only.
I have written the sql query and tested it too. I am wondering ...
I have a simple hibernate mapping file that makes use of a custom value type for one of the fields. The custom value type contains some reasonably complex business logic. I would like to be able to unit test my object persistence without the custom value type's logic. Is there any way to mock out the custom value type?
I have seen a ...
Hi,
I am new to Hibernate and what are some good video tutorials/online tutorials to guide me ?
Thanks.
...
Hi all,
I have a hibernate mapping like this in a ProductDfn class
@ManyToOne( fetch = FetchType.LAZY, optional = true )
@JoinColumn( name = "productTypeFk", nullable = true )
public ProductType getProductType()
{
return productType;
}
Note that the relationship is defined as optional (and the column is nullable).
When doing HQL...
These are the tables I want to map using Hibernate:
user (PK UserId)
article (PK ArticleId, FK CreatorUserId)
category (PK CategoryId, FK ParentCategoryId)
I have been looking at the documentation for Hibernate, but I really cannot choose what type of mapping is the most suitable for my tables.
Any help would be greatly appreciated! ...
Hello everyone,
I am using Hibernate(3.2) Criteria for querying and its giving me exception when converting to a list.
Please see my code and exception below:
List<Summary> summaryList;
Criteria criteria = session.createCriteria(Summary.class);
session.beginTransaction();
summaryList = Criteria.setProjection(
Pro...
I use the following spring application context:
<!-- Hibernate session factory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="hibernateProperties">
<props>
<!--
<prop key="h...
Suppose I have classes like:
class A {
B getB();
C getC();
}
class B {
String getFoo();
}
class C {
int getBar();
}
and I want to filter criteria on A, two filters on different subclass properties, like:
Criteria criteriaA = session.createCriteria(A.class);
Criteria criteriaB = criteriaA.createCriteria("b").add(Restrictions.eq(...
I have a Hibernate hbm.xml mapping file which defines a large number of class mappings. Each of these needs an <id> definition and a corresponding <generator> definition.
In this particular application, the <generator> definition is quite involved, including setting a number of parameters (e.g. increment size, optimizer, etc). Having t...
I'm new to NHibernate (and ORMS) and trying to come to grips with the myriad of different options it presents. For reference, I'm using Fluent NHibernate with seperate business objects which in turn use DTO's purely for data access. My application architecture must support both windows and web "front ends".
My quandry is one of general ...
Hi,
I have 3 non-abstract persist-able classes. MyClubUser and HisClubUser classes inherit from User class. I use one table per subclass strategy i.e. @Inheritance(strategy = InheritanceType.JOINED), for these classes.
What I have observed was the generated SQL uses left outer join HisClubUser and MyClubUser when I do a query on User ...
Short Version
I'm currently looking into an issue with MySQL collations and how they affect a Set of values (which is mapped using Hibernate, but that shouldn't matter for now). I want to have a Set of Strings using the same collation as MySQL uses. E.g. I want "foobar" and "fööbar" considered equal but "foo bar" and "foobar" considered...
I know how to join tables in an SQL update but how do I do it in HQL?
Long story: I have items which I process in a run. Each run as an ID and I have a many-to-many relation between items and runs (which is in an extra table).
Now I want to set the state of all items used in a certain run. The naive approach looks like this:
update It...
Hi,
I'm using Hibernate (in a Grails app) and the transactional boundaries are service methods, i.e. every time a service method is called a transaction starts, and every time a service call completes the transaction is either rolled back or committed.
If one of the database operations causes a database trigger to fire, and this trigge...
Following the theme of other threads.
What are your most favorites tricks or techniques involving Hibernate?
My favorite is binding non-Hibernate generated classes to existing classes with additional functionality (i.e. summarization).
...
Alright, I've got a quick question. I'm currently working with a legacy database, so I can't change around much. The database revolves around a single type, the entity. All other relevant data (except for customizable lists etc.) 'inherit' from this.
I'm mapping this with a joined subclass approach, which is working fine. The problem ho...
Hello good fellas!i'm a bit confused about something right now about hibernate property.I have a parent class that doesn't need to browse it's child for now , eg the type of table that just hold information (id| currency | description)
so in the mapping file of the parent i ignore the set tag.
in the child class i have reference to the p...