[hibernate-dev] Multiple joined-subclass mappings to same table

2015-02-10 Thread Unmesh Joshi
Hi,

I am bit puzzled with this. I am looking at a codebase, where there are
multiple joined-subclass mappings (in separate hbm.xml files) which map to
same table. For union-subclass, we correctly get exception for duplicate
mapping. But for joined-subclass it allows multiple mappings to same table.
In the hibernate source code, I see that for Joined subclass, the table
mapping is added with following method call.

Table mytable = mappings.addTable(
schema,
catalog,
getClassTableName( joinedSubclass, node, schema, catalog, null, mappings ),
getSubselect( node ),
false

For union-subclass, the mapping gets added with

Table mytable = mappings.addDenormalizedTable(
schema,
catalog,
getClassTableName(unionSubclass, node, schema, catalog,
denormalizedSuperTable, mappings ),
unionSubclass.isAbstract() != null && unionSubclass.isAbstract(),
getSubselect( node ),
denormalizedSuperTable
);

mappings.addTable doesnt throw exception if the table mapping already
exists.

Is the behaviour for joined subclass by design? Because I see this fact
being used in some projects, where to extend an already created
joined-subclass, a new hibernate-config file is added with joined-subclass
definition duplicated, with additional attributes (and columns) added to
existing table. So essentially, you have two joined-subclass definitions,
mapping two separate entities to same table.
This does look like using some loop hole in the code?

Thanks,
Unmesh
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev


[hibernate-dev] Question about substituting IDs in Hibernate OGM

2015-02-10 Thread Haswell, Josiah D
Hi folks,

I'm creating a Hibernate OGM implementation for Datomic, and I have a question 
about IDs.

Say I have the entity

@Entity
public class Person {
@Id
@GeneratedValue
Long id;


}

In Datomic, you have to assign a temporary ID before submitting the 
transaction.  Datomic will then return the actual persistence ID after the 
transaction has completed.  My question is, how can I get the actual ID back 
into the entity?

Thanks!

Josiah
___
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev