Hi guys,
I'd like to understand how it is possible:
Until I was working with one table everything worked fine,
when I have mapped another table it fails as shown below:
Glassfish start
INFO: configuring from resource: /hibernate.cfg.xml
INFO: Configuration resource: /hibernate.cfg.xml
INFO: Reading mappings from resource : hibernate_ce...
I have a spring-hibernate application which is failing to map an object properly: basically I have 2 domain objects, a Post and a User. The semantics are that every Post has 1 corresponding User.
The Post domain object looks roughly as follows:
class Post {
private int pId;
private String attribute;
...
private User user;
...
I am creating a custom UserType class in Hibernate. The specific case is for an HL7v3 clinical document (I work in health IT). It is a mutable object and most of the documentation around the Hibernate UserType interface seems to center around immutable types. I want a better understanding of how and when the interface methods are used, s...
Hi,I have the following mapping:
Person class mapping:
<hibernate-mapping ...>
<class="my.Person" table="PERSON" where="deleted is null">
...
<sql-delete>
update PERSON set deleted = true where id=?
</sql-delete>
</class>
</hibernate-mapping>
Geek class mapping:
<hibernate-mapping ...>
<joined-subclass name="my.G...
Hi,
I'm using Hibernate with Xml mappings. I have an entity that has two fields creationDate and updateDate of type timestamp, that have to be filled with the current UTC time when the entity is persisted and updated.
I know about the existence of the @PrePersist and @PreUpdate annotations, but i don't know how to use their equivalent in...
I've just started using hibernate and I'm trying to map walking distance between two coordinates into a hashmap, There can be many connections from one "FromCoordinate" to another "ToCoordinate". I'm not sure if i've implemented this correctly, What annotations do i need to map this MashMap? Thanks
HashMap> coordWalkingConnections = new...
I have a Summary class which contains a list of Qualities. A Quality contains a String name and int value. This data is stored in a denormalized db structure, one table only, for both Summary and Quality.
Quality table:
id,
somefileds,
qualityname1,
qualityvalue1,
qualityname2,
qualityvalue2,
qualityname3,
qualityvalue3
For each quali...
Working on some legacy hibernate code.
How do I do the following with hbm.xml(hibernate mapping file) instead of with annotations?
@Table(name="users", uniqueConstraints = {
@UniqueConstraint(columnNames={"username", "client"}),
@UniqueConstraint(columnNames={"email", "client"})
})
public class User implements Serializable {
...
hi,
i am currently working on one project. In my project there are many entity/POJO files. currently i am using simple hibernate.cfg.xml to add all the mapping files in to the configuration like :-
<mapping resource="xml/ClassRoom.hbm.xml"/>
<mapping resource="xml/Teacher.hbm.xml"/>
<mapping resource="xml/Student.hbm.xml"/>
i am havin...
Hi,
I have a two nodes environment using the
same database. In the database there
is a resource table like
RESOURCE_ID,
CODE,
NODE
The content of the NODE column can be 1 or 2 depending on which node can use it.
As I need to deploy the same ear to the two nodes, I would like to map this table like this:
<hibernate-mapping>
<cla...
Hi, I am having some trouble with returning a non-empty Set into an object using Hibernate and a custom CompositeUserType key.
I have a set of tables and views (simplified here):
create table lang (lang_id,lang_cd);
create table article (art_id,...);
create table article_lang (art_id, lang_id,title,...);
create view article_lang...
I am developing a project in which I am persisting some POJOs by adding Hibernate annotations. One problem I am running into is that code like this fails, as Hibernate tries to map the sub-fields within the Time_T onto the same column (i.e. startTime.sec and stopTime.sec both try to map to the colum sec, causing an error).
@Entity
publi...
I have an object hierarchy that is as follows.
Party > inherited by > Organization and Person
Organization > inherited by > Customer, Vendor
Person > inherited by > Contact
In the database I have the following tables
Party, Customer, Vendor, Contact. All of them have a corresponding row in Party table.
Contact belongs to either Vendor...
Following grails domain class:
class MyClass {
Map myMap
}
Now for myMap, grails automatically creates a new table for the elements in the map. However if I add elements which are too long (e.g. 1024 characters), I get a DB error.
Can I somehow tell grails to make the respective column in myMap's table big enough to allow for large...
I have 2 entities/tables.
One is a proper entity, let's call it data. It has a number of fields containing so-called "multilingual codes".
The second table, code, contains the multilingual values themselves.
Here is some example data :
Data table
id name continentCode countryCode
------------------------------------
1 ...
i need to know how to use the bag tag and what is the purpose?
...
My PostgreSQL tables have id's of type bigserial, meaning they are generated at the time rows are inserted (and thus, the id column's value is not supplied in the INSERT statement). I'm having difficulty finding the proper value for the <generator class="..."> attribute in my XML mapping file.
The code below is the closest I've found t...
I have a property of a business object which is calculated. The calculation involves some of the logged in user's details, and so can't be represented as a simple SQL query.
I'm having trouble representing the field in the Hibernate mapping XML file, because Hibernate continues to try and retrieve the field from the database, although ...
I have 2 tables parent/child which I am trying to insert records in. ParentID is a surrogate key in child table. I have cascade="all" in parent table's hbm.xml file.
When I try to save both through my junit test case, both parent and child records get saved but when same thing is done through application running in jboss, record in paren...
I am trying to generate hibernate-mapping from POJOs with hibernate annotations.
Then I want to use liquibase to generate database schema.
So I need indexes to be defined in my POJOs.
Sample POJO:
@Entity
public class A {
@Id
@GeneratedValue
private Long id;
@Index(name = "IDX_NAME")
@ForeignKey(name="sd")
p...