Hi,
I previously asked a question regarding modeling of a situation with Users, Items, and UserRatings. In my example UserRatings are associated with one User and one Item. A good answer was provided by Nathan Fisher and I've included the model he suggested below.
But I now have a question regarding retrieval of these objects.
The...
I have to use Hibernate and retrieve data from Oracle but the problem is, that the number of parameters passed to the query is not always the same.
For the sake of simplicity let's consider the following query:
select COL_1, COL_2, ..., COL_N from TAB_1 where COL_1 in (?, ?, ... ?)
The number of parameters passed to in clause is betwe...
I have an instance of a class that I got from a Hibernate session. That session is long gone. Now, I'm calling toString() and I'm getting the expected LazyInitializationException: could not initialize proxy - no Session since I'm trying to access a reference which Hibernate didn't resolve during loading of the instance (lazy loading).
I...
In my application, I am storing a small table containing 50 records in a singleton class because the data in this table hardly changes - e.g. the list of countries.
Although, the concept is not good, I have to continue with it right now. Is there any solution in Hibernate which observe change in the table and on change, invoke a method...
Hi!
I'm having problems with a Hibernate criteria. I'm trying to make a Criteria where I look at the id of a member object of the class the query returns.
For example:
Criteria crit = session.createCriteria(Enquiry.class) crit.add(Expression.eq("lecture.admin.id", userId));
The result of this is an exception:
org.hibernate.QueryExcept...
I'm trying to add a composite primary key to a class and having a bit of trouble. Here are the classes.
class User {
private long id;
...
}
class Token {
private User user;
private String series;
...
}
I'm using the orm.xml to map the classes because they're actually part of a higher level API that I don't want to...
Hello good people
i'm just curious about something.I'm using hsql in myproject (embedded of course).At some time i felt the need to visualize what hibernate was generating.I took a free copy of dbvisualizer. here is the hsqljdbc.properties
jdbc.url=jdbc:hsqldb:file:mydb;create=true
hibernate hbm2ddl.auto=create
i downloaded t...
I'm using Hibernate Validator in an application with EJB and Spring MVC. I'm using JBoss 5, Hibernate 3 and Spring MVC version 3.
I'd like to try and catch validation exceptions at Spring Exception Resolver level and generate an error message based on the InvalidStateException message. I don't want to put exception handling logic in t...
hello good people! thanks to you guys my knowlegde on hibernate has been improve dratiscally.
now i hit a block here about current_timestamp.
here is my codes
@Column(name="DATE_CREATED", insertable=false, updatable=false, columnDefinition="timestamp default current_timestamp")
@org.hibernate.annotations.Generated(value=GenerationTime....
As a Java developer new to the web development environment, I was quite excited to find Grail which provides a great framework especially the convenience of abstracting DB operations with ORM. I later learned that it is actually the function of hibernate. At the same time I am delighted to learn about GWT. It is a god send for the projec...
I have the following mapping
@Entity
@SequenceGenerator(name="sacpSequenceGenerator", sequenceName="SACP_SEQ")
public class Sacp {
private Integer id;
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="sacpSequenceGenerator")
public Integer getId() {
return this.id;
}
// other setter's a...
I have a 2 entities in a One-To-Many relationship:
OfficeView.java:
public class OfficeView implements java.io.Serializable {
private Integer officeId;
private String addr1;
private String city;
private String state;
private String zip;
private List<Devices> devices;
getters and setters
@OneToMany(mappedB...
Hi,
I'm relatively new to hibernate and was wondering if someone could help me out.
While I have no issues implementing a normal join on multiple columns in hibernate using the @JoinColumns tag, I'm stumped when trying to implement the following query in annotations:
SELECT A.* FROM TABLEA A
LEFT OUTER JOIN TABLEB B
ON A.UID = B.ID
AND...
Hi,
We can speed up a hibernate app easyly with 2nd level cache using infinispan or ehcache/terracotta,... but ibatis only have a simple interface to implement for caching. And hibernate knows more information about the data, so it helps for better caching, too. In the other side, the simplicity of ibatis is also the power of it and it'...
Hello good people.
I 'm trying to build a user and a contact management project.
i have a lot of classes so will limit it to what are in concern here. i have a userAccount, userProfile, and group
here is the UserAccount Mapping
@Id @GeneratedValue
@Column(name="USER_ACCOUNT_ID")
private Long ID;
......
@Column(name="EMAIL", length=10...
I am very new to this caching techniques. I just managed to configure JBossCache with Hibernate on JBoss AS 4.23 GA.
My question is Suppose I have two different configurations defined in the configuration file. One is optimistic-entity and second one is pessimistic-entity. I want to use optimistic-entity configuration for one set of en...
I am facing a weird problem and it seems to be c3p0 related. I am starting two instances of an app in the same java vm which interact with each other. After some operations "APPARENT DEADLOCK" messages appear in the log.
I have the feeling that both app instances use the same connection pool although they use different session factory i...
I have JSF + Hibernate app. During runtime, i need to change database, to which user is connected. For example, User can manually switch databases in my app, so app is connected to the chosen one. I read about Hibernate Connection Provider. Can it help me?
...
How to connect to the MSSQL database by using Hibernate in Netbeans 6.7.1? Please advice.
The dialect is disabled for me.
...
Hello,
I am trying to persist a one-to-one relation with Spring 1.2.8 and Hibernate 3.2.7ga but the foreign key is always empty.
But let me first give you a short introduction:
I have two Entities called "ClientDomain" (Web-Domain) and "Measurement".
Hibernate Mapping Files:
ClientDomain.hbm.xml:
<hibernate-mapping package="statist...