My entities currently contain java Date properties. I'm starting to use Joda Time for date manipulation and calculations quite frequently. This means that I'm constantly having to convert my Dates into Joda DateTime objects and back again.
So I was wondering, is there any reason I shouldn't just change my entities to store Joda DateTi...
I am using oracle 10. I need to sort my result set according to two numeric string fields.
one sort criterion field holds data like this:
FIELD1:
FO-100001001001
FO-100001002001
FO-100001003001
SQ-200001003001
FC-102001003001
the other :
FIELD2:
000203
000567
349990
I need to combine the two criterion , the first criterion take t...
Does it make sense to have a @OneToOne member contain a @ForiegnKey annotation.
@Entity
class User {
@Id
@GeneratedValue(strategy = IDENTITY)
int id;
@OneToOne
@ForeignKey
@JoinColumn(name = "home_address_id", referencedColumnName = "id")
Address homeAddress;
}
@Entity
class Address {
@Id
@Generat...
Again I have a hibernate issue. When adding a new Entity to a persisted Collection by merge() I get a NullPointerException from somewhere inside of Hibernate
that's the stacktrace:
java.lang.NullPointerException
at org.hibernate.type.AbstractType.getHashCode(AbstractType.java:136)
at org.hibernate.type.AbstractType.getHashCode(...
What is the difference between one to one and many to one mapping in hibernate?
...
I have a strange error with Hibernate3 here:
Got a SoftwareDescription class, persisting it with the following field commented out works just fine:
@OneToMany
@JoinColumn(name = "id")
private List<SoftwarePrice> prices = new ArrayList<SoftwarePrice>();
Got getters and setters for this field. When I try to persist a SoftwareDescriptio...
What is lazy loading in Java? I don't understand the process. Can anybody help me to understand the process of lazy loading?
...
Hi all,
I searched there, and didn't find any similar topic, so I am posting a new question.
I am working with Hibernate on an existing Database. The table structure and data we are not allowed to change. The application is reading data from the database and migrating to another datastore based on some logic.
Now the problem is about ...
Hi,
When setting up a JDBC connection in a J2EE application, do you need to specify the schema name in addition to the database name?
I have followed this tutorial and have setup a database, and username/password, but I'm coming up against this error when I startup my application. Is it possible that DBUnit is trying to insert the data...
I want to get the count of the results of a dynamically-generated HQL query, without actually getting the list of results. Say that the query I have is something like:
select Company company LEFT OUTER JOIN FETCH products product
I read in the Hibernate documentation that:
You can count the number of query results without returnin...
Hello,
I'm using hibernate with mySQL and I've the following problem: I do a nativeSQL query on a table with, among others, a column that is a character long. This column can get to null. Now I receive the following exception while querying:
4-feb-2010 10.31.00 org.hibernate.type.NullableType nullSafeGet
INFO: could not read column val...
I've got a curious puzzle with an object-relational mapping, using Java and Hibernate.
We have an existing schema that looks something like this:
create table foo (id int8, /* ... */ primary key (id));
create table bar (id int8, foo int8, /* ... */ primary key (id));
alter table bar add constraint fk_foobar foreign key (foo) references...
When programming directly in JDBC against an Oracle database you can call stmt.setFetchSize(fetchSize) on the statement to determine the max number of records to fetch in one round trip from the small default value. I'd like to do this from withing Hibernate 3.2.
Can someone tell me where this would be set?
...
I have a very weird problem.
Have an application using Hibernate and spring.I have an entitymanger defined which uses a JNDI lookup .It looks something like this
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<propert...
Hi!
I have been struggling with the following problem:
I have a value object containing different panels. Each panel has a list of fields.
Mapping:
<class name="com.aviseurope.core.application.RACountryPanels" table="CTRY" schema="DBDEV1A" where="PEARL_CTRY='Y'" lazy="join">
<cache usage="read-only"/>
<id name="ctryCode">
<column name...
I realized that any application which uses hibernate, fails to undeploy completely in Glassfish 2.1.1. Many classes remain in memory after the undeployment process, you can check it using jmap and jhat.
I've done several tests, and figured out that only applications which had hibernate failed to have a clen undeploy process. My Databas...
currently I am using the following to pull rows from a table called Table:
return getHibernateTemplate().find("from Table");
How do I use hibernate to pull only the first n rows from the table (i.e. like a mySql limit would do)?
Thanks.
Update: so is this the proper way to do it?
getHibernateTemplate().setMaxResults(35);
return get...
Is it possible with NHibernate validators to get a validator that will validate one or other properties? In the example below either FirstName OR Surname is required.
[OneOrOther("Group")]
public string FirstName {get; set; }
[OneOrOther("Group")]
public string Surname {get; set; }
...
In my GWT service on server side I use Hibernate. When creating a SessionFactory I get following error:
"java.lang.NoClassDefFoundError: java.net.Socket is a restricted class. Please see the Google App Engine developer's guide for more details."
What could be the reason?
...
Hi,
I have a User hibernate class, Clerk class and Consumer class. All these maps to their own tables in database. The User PK also acts as Clerk's and Consumer's PK.
So now my problem is that if a user is initially a Clerk, he has a record in Users table and Clerks table. If that user wants to become a consumer, I want to link that U...