I am having a querying issue in Hibernate. I have a table, 'test', with existing data. I have a requirement where I can not modify the schema of the test table, so I created another table, 'testExtension', whose primary key is a foreign key to the primary key of Test. Data in testExtension is a subset of the data in test. i.e. There w...
Okay, so I have torn what I had down and am rebuilding it, here's what I need to do.
I have an entity called Property with:
String name;
@ManyToOne
EntityType type;
??????? value
I need to store a Value too, but depending on the Type, the value could be either a String, a Double, or a link to another object (of Class type.getJavaCl...
What is the best approach to set servlet context variable in Struts? This variable is displayed on every single page in header tile and has to be loaded from DB. For that purpose there is Hibernate DAO and Spring Service which returns the requested value.
My current approach was to extend Struts PlugIn class and inject my service into i...
I am looking for a way to get hibernate to use oracle's SYS_GUID() function when inserting new rows. Currently my DB tables have SYS_GUID() as the default so if hibernate simply generated SQL that omited the value it should work.
I have everything working, but it is currently generating the UUID/GUID in code using the system-uuid genera...
how do i change hibernate logging level programatically.
...
When developing a new project I often want to re-create the schema to apply any new entities or relationships created. I like using hibernate tools in eclipse, but it's a pain when wanting drop and re-create the schema - since it seems to maintain open connections to the db (postgres in this case).
Does anybody know if there is an easy ...
Hi all,
I've got two legacy database tables, layouted in simplified manner like this:
MASTER SLAVE
ident ident
sName sName
sNumber sNumber
sDesc sValue
----- ------
Java Class 'ScenarioMaster' ...
I'm trying to create an address book application with one table for People, another for Companies and a third one for Phones. The Phones table will have the data for the People and the Companies with a field indicating where it came from. Let's assume that these are the simple tables:
CREATE TABLE `Person` {
`id` int(11) NOT NULL au...
I get a java.lang.IllegalArgumentException: Unknown entity: path.to.MyEntity.
I have explicitly specified the provider in persistence.xml using:
<persistence-unit ...>
<provider>org.hibernate.ejb.HibernatePersistence</provider>
</persistence-unit>
and MyEntity is annotated appropriately.
The hibernate portions of the exception tr...
Hi,
I'm trying to map some existing tables with Hibernate.
It's quite simple: we've got categories that have names in multiple languages.
The DDL is as follows:
create table language (
id integer not null auto_increment,
code varchar(2) not null,
unique (code),
primary key(id)
);
create tabl...
I have two classes I would like to persist via NHibernate:
- Cat, which has a name and an Id,
- Kitten, which is a subclass of Cat (no extra public properties).
For stupid reasons, I would like to know if it is possible to map Cat only? So that when I persist Kitten, it is saved as a Cat and when I reload it, it is loaded as a Cat.
Add...
How can I map a Map in JPA without using Hibernate's classes?
Thanks in advance.
...
I have an object:
public class Data {
private long id;
private long referenceCount;
private Blob dataCache;
/* getters and setters for the above */
}
Corresponding to this is a mapping:
<hibernate-mapping>
<class name=Data" table=DATA">
<id name=id" type="long">
<column name...
Hello,
I'm new to using Hibernate with Java. I'm getting the following exception. The stuff that I found online regarding this error didn't seem to help. Any ideas?
The Exception:
java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException:
ApplPerfStats is not mapped [select count(c) from ApplPerfStats c]
at or...
I developed a Java web application in Netbeans 6.5 using a MySQL database and Hibernate. Both the development database server and development application server (Tomcat 6) reside on my development machine. Everything works; the application pulls data from the database correctly.
Now, I'm ready to move it to the production server. Aga...
I have a problem.
My application makes use 1) of an existing hibernate connection for retrieving some data.
Now i t has to 2) update some tables in the same DB from which data is retrieved and this has to happen through seperate connection.
Is it possible to have a hibernate.cfg.xml file seperately for this purpose?
if so how will i d...
Hi,
I have a bean which I map to the database using Hibernate. I'm using Hibernate Annotations to indicate the mapping I want, and to create the indices. The thoroughly simplified code is shown below.
The problem I have is that the indices on my byte[] field are not created; specifically that my multi-field index sysUuid does not get c...
I've got a pair of Hibernate entities, A and B, that are related via a bidirectional many-to-many relationship, as described here - ie, each entity has a bag referencing a collection of the other type of entity, with a link table comprising the primary key of each entity.
I am also using Hibernate L2 caching to cache the collection valu...
Hello, I have an ongoing difficulty grasping the technical implementation details of connection pooling. I have read quite a few of related articles such as this one
and this one, but still not 100% clear. Is connection pooling tied to tomcat, mysql, or the other development frameworks (struts2, spring, hibernate)? I mean do each of thes...
Using JPA query language, how do I determine the size (number of rows) in an entity (table)?
...