I have a custom SQL query in Hibernate (3.5.2) in which I want to return a mapped object, and an associated (joined) object. However, Hibernate seems to be giving me a list of arrays rather than a list of objects.
To simplify my situation a bit :-
Entity1 contains a foreign key to Entity2, and the mapped objects are set up so that Enti...
Hello,
I'm not sure whether it is the right terminology for this kind of relationship, so please correct me. I need to define a domain class, which maps to a table in the database. The class needs to define a hierarchy of relationships of the same type. For eg, say I need to model the below roles with the same class
Admin > Manager > S...
Is it possible to write a HQL query that groups results by the discriminator value of a table per class hierarchy mapping? For instance
"select discriminator d, count(*) c from Foo group by discriminator"
with a mapping like
<hibernate-mapping>
<class abstract="true" name="Foo">
<!-- SNIP -->
<subclass name="Bar" discrimina...
I need to modify the web start up service to query some database objects and put it into the session when the server(JBOSS 5) starts. Any idea what is the best way to do it? I am using struts2.1.6 + spring 2.5.6 + JPA + Hibernate.
Thanks.
...
Can someone please tell me where can I find the driver and the dialect files to connect hibernate to sqlite. Please reply trough my email because I live in Cuba and internet connection is not stable and very slow so the navigation gets difficult to me.
Thank you very much,
Diana,
[email protected]
...
I have a few Hibernate Envers listeners which I use for audit purposes. I am just getting started on CDI and so far am pleasantly surprised by its simplicity and power. Since it seems everything is integrating CDI functionality, I thought I'd raise the question, is Hibernate supporting it or will it?
Not only would it be nice to have ...
while generating DAO classes using hbm2dao, is it possible to provide a custom package name and class name. I don't want to use the Home.java and the default package. By tweaking the template, I can change the name of the class in the java file where it says
public class <classname>DaoImpl
But don't know how to change the name of the ...
What book/article do you recommend for learning hibernate?
...
I'm writing some integration tests for a Spring/Hibernate app I'm working on, and I would like to to test things with as close to real conditions as possible, which includes using Hibernate's second level cache and committing transactions.
I was wondering if there was an efficient way to ask Hibernate to delete everything from the datab...
I currently have a hard coded view with the following sql:
select username
,(case user_role.role_id when 1 then true else false end) as ROLE_SUPER
,(case user_role.role_id when 2 then true else false end) as ROLE_ADMIN
,(case user_role.role_id when 3 then true else false end) as ROLE_VIEW
,(case user_role.role_id whe...
Hi, I have been having trouble with Hibernate and Mysql timeout error for a week.
Apparently, After my Hibernate/MySQL have been running after 8 hours(which is default timeout value in Mysql), I have the exception. I also added c3p0. But it doesn't help.
Please advice
Thank you so much
Here is my Hibernate Configuration:
<property ...
I have four entities that are involved in a query that I'm having a little trouble with. The relationship is as follows : Exchange----*Contract*----*Combo----*Trade and the (simplified) entities are as follows:
@Entity
public class Exchange implements Serializable {
@Id(name="EXCHANGE_ID")
private long exchangeId;
@Column
...
Hi guys I am new to Hibernate and JPA
I wrote some functions, initially, I set fetch = FetchType.LAZY in the entity class.
But it gave me error:
"org.hibernate.LazyInitializationException: could not initialize proxy - no Session"
@OneToMany(cascade = CascadeType.ALL, mappedBy = "logins", fetch=FetchType.LAZY,targetEntity=Invoice.clas...
I have a list of IDs in a String, and want to use Hibernate to get the rows with these IDs. TrackedItem is a Hibernate/JPA entity (sorry if I'm getting the naming mixed up here).
My code is:
String idsText = "380, 382, 386";
ArrayList<Long> ids = new ArrayList<Long>();
for (String i : idsText.split(","))
{
ids.add(Long.getLong(i))...
I have been using my own internal custom authorization model which evaluates whether a user has permission to view, edit, delete, or create an item. For instance, one place I use this is to determine if a user has permission to view a resource. I have some restrictions such as whether the item is published, whether the user belongs to ...
Hi All,
I use EJB3 container managed persistence i.e an EntityManager is injected via @PersistenceContext annotation. The persistent context then may be propagated to nested EJBs. Transactions are also managed by the contaner (glassfish).
Usually I would drop persistence.xml into META-INF directory and the container would work out whic...
I'm building a simple web application that handles a simple database using struts and hibernate (so far the application works just fine with these two frameworks), Now I want to add Spring to this application. I have some basic knowledge of how Spring works, but I don't know to which part I need to add Spring's capabilities.
Application...
I have a legacy DB with rather simple structure. I have "rolls" that contain "rollTotals".
Roll has a primary key of "rollID" and RollTotals have a composite key on "rollID" and "category".
So in Grails, I have:
class Roll {
Integer id
...
static hasMany = [ rollTotals: RollTotal ]
static mapping = {
table('roll...
Somebody asked this question on the Hibernate forums and I'm linking to it here because I have the same question. Nobody seemed to be of any help there so I'm hoping this might be more useful.
Here it is:
Question on Hibernate forum
Thanks.
...
Hello
While installing my project to local repository with mvn install command, hibernate mapping files are excluded from generated JAR.
I have the *.hbm.xml files under src/main/resources/traffic_domain/mapping/, so it should be ok as it is following standard directory layout for maven.
my POM file looks like that:
<project>
<mode...