[Hibernate-JIRA] Created: (ANN-793) @ManyToOne - @OneToMany doesn't work with @Inheritance(strategy= InheritanceType.JOINED)
by Tomaz Cerar (JIRA)
@ManyToOne - @OneToMany doesn't work with @Inheritance(strategy= InheritanceType.JOINED)
----------------------------------------------------------------------------------------
Key: ANN-793
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-793
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.4.0.GA
Environment:
Hibernate Core 3.3.1.GA
Hibernate Annotations 3.4.0 GA
Hibernate EntityManager 3.4.0 GA
Jboss 4.3 EAP,
DB2 9.5
Reporter: Tomaz Cerar
I am trying to create bidirectional association between two entities in which one can be Inherited and it fails with table not found:
11:37:39,229 ERROR [AssertionFailure] [] an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
org.hibernate.AssertionFailure: Table CRM.CRM_AKTIVNOST_DOGODKI not found
at org.hibernate.persister.entity.JoinedSubclassEntityPersister.getTableId(JoinedSubclassEntityPersister.java:480)
at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:259)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:87)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:261)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:246)
The code looks like this:
@Entity
@Table(name = "CRM_AKTIVNOST")
public class Aktivnost implements Serializable {
private List<Dogodek> dogodki;
....
....
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL,mappedBy = "aktivnost")
public List<Dogodek> getDogodki() {
return dogodki;
}
public void setDogodki(List<Dogodek> dogodki) {
this.dogodki = dogodki;
}
...
...
}
@Entity
@Table(name = "CRM_DOGODEK")
@Inheritance(strategy= InheritanceType.JOINED)
public class Dogodek implements Serializable {
...
...
private Aktivnost aktivnost;
....
....
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinTable(name = "CRM_AKTIVNOST_DOGODKI", joinColumns = {@JoinColumn(name = "DOGODEK_ID")}, inverseJoinColumns = {@JoinColumn(name = "AKTIVNOST_ID")})
public Aktivnost getAktivnost() {
return aktivnost;
}
public void setAktivnost(Aktivnost aktivnost) {
this.aktivnost = aktivnost;
}
...
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 5 months
[Hibernate-JIRA] Created: (HV-350) Inherited Bean validates non-default constraints as default
by Marc Schipperheyn (JIRA)
Inherited Bean validates non-default constraints as default
-----------------------------------------------------------
Key: HV-350
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-350
Project: Hibernate Validator
Issue Type: Bug
Components: engine
Affects Versions: 4.1.0.Final
Environment: Spring 3.0.3
Reporter: Marc Schipperheyn
Assignee: Hardy Ferentschik
Let's say you have 2 beans
public class Vehicle{
@AssertTrue(groups={CheckMaintenance.class,CheckRoad.class})
public boolean oilCheck;
@NotNull(groups={CheckRoad.class})
public String plate;
}
public class Car extends Vehicle{
@Min(value=4)
public int numWheels;
}
validate(car,Class<?>[]{Default.class,CheckMaintenance.class});
If I validate Car, all the Vehicle validations are selected as Defaults as opposed to by their specific marker interface. In other words, Validator validates plate regardless of the fact that CheckRoad is not part of the array of marker interfaces specified for this validation. I assume this has something to do with the inherited nature of the class.
Stepping through the code, I can also see that the groups Descriptor of the ConstraintDescriptorImpl 'loses' non default groups for the inherited constraints.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 5 months
[Hibernate-JIRA] Created: (HHH-4647) Problems with @JoinColumn referencedColumnName and quoted column and table names
by Peter Brant (JIRA)
Problems with @JoinColumn referencedColumnName and quoted column and table names
--------------------------------------------------------------------------------
Key: HHH-4647
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4647
Project: Hibernate Core
Issue Type: Bug
Components: annotations, core
Affects Versions: 3.5.0-Beta-2
Environment: current CVS, not database platform dependent
Reporter: Peter Brant
Attachments: hibernate-annotations.patch, hibernate-core.patch, test-case.zip
There are really two separate issues here, but the test case reduction and patches are so small (and involve related functionality) they are combined.
#1: A referencedColumnName that references a quoted target column cannot be found. The test case is app.TestReferencedColumnName#testQuotedReferencedColumnName(). The patch is hibernate-annotations.patch.
#2: An invalid referencedColumnName (including the unquoted version of a valid column) results in an infinite loop in o.h.c.Configuration$MappingsImpl#getPhysicalColumnName(). The test case is app.TestReferencedColumnName#testInvalidReferencedColumnNameOnQuotedTable. The patch is hibernate-core.patch. It looks like the same issue exists with getLogicalColumnName(), but I'm not sure where this is used (i.e. how to test it) so I left it alone.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 5 months
[Hibernate-JIRA] Created: (HHH-5109) @OneToOne - too many joins
by Marek Romanowski (JIRA)
@OneToOne - too many joins
--------------------------
Key: HHH-5109
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5109
Project: Hibernate Core
Issue Type: Bug
Components: annotations, core
Affects Versions: 3.5.0-Final
Reporter: Marek Romanowski
Attachments: hibernate-one-to-one.zip
With classes like this:
@Entity
@Proxy(lazy=false)
class Owner {
@javax.persistence.Id
@javax.persistence.Column(name = "ID", columnDefinition = "BIGINT")
public java.lang.Long getId() {
return this.id;
}
public void setId(java.lang.Long newValue) {
this.id = newValue;
}
private java.lang.Long id;
@javax.persistence.OneToOne(targetEntity = Owned.class)
@org.hibernate.annotations.Cascade( { org.hibernate.annotations.CascadeType.ALL })
@javax.persistence.PrimaryKeyJoinColumn
public Owned getOwned() {
return this.owned;
}
public void setOwned(Owned owned) {
this.owned = owned;
if (owned != null) {
owned.setOwner(this);
}
}
private Owned owned;
}
@Entity
@Proxy(lazy=false)
class Owned {
private java.lang.Long id;
@javax.persistence.Id
@javax.persistence.GeneratedValue(generator = "foreign")
@org.hibernate.annotations.GenericGenerator(
name = "foreign",
strategy = "foreign",
parameters = { @org.hibernate.annotations.Parameter(name = "property", value = "owner") })
@javax.persistence.Column(name = "ID", columnDefinition = "BIGINT")
public java.lang.Long getId() {
return this.id;
}
public void setId(java.lang.Long newValue) {
this.id = newValue;
}
@javax.persistence.OneToOne(targetEntity = Owner.class, mappedBy = "owned")
@javax.persistence.PrimaryKeyJoinColumn
public Owner getOwner() {
return this.owner;
}
public void setOwner(Owner owner) {
this.owner = owner;
}
private Owner owner;
}
Idea is to have one to one relation between Owner and Owned mapped by "id" properties in both entities. So for each pair owner.id == owned.id.
code:
session.load(Owner.class, 1L)
turns into SQL:
select owner0_.ID as ID0_2_, owned1_.ID as ID1_0_, owner2_.ID as ID0_1_
from Owner owner0_ left outer
join Owned owned1_ on owner0_.ID=owned1_.ID
left outer join Owner owner2_ on owned1_.ID=owner2_.ID
where owner0_.ID=?
Isn't it wrong? @OneToOne annotation on getOwner() has mappedBy="owned" property, so I would expect this code to generate SQL with only one join (only "owner join owned"). If this is correct H3 behaviour in this case, then write what should I change in annotations to get described behaviour, please.
I've attached maven project with one test encapsulating this issue.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 5 months