[Hibernate-JIRA] Created: (HHH-3293) Event System is poorly document
by Alberto A. Flores (JIRA)
Event System is poorly document
-------------------------------
Key: HHH-3293
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3293
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.6
Reporter: Alberto A. Flores
In reading interceptor vs. event listeners, it appears that documentation on "event systems" is very poor. Further more, there is no documentation as to how and when evenlisteners are called (which can be relevant depending on the constraints specified in the hbm file and/or db schema. I encountered a problem where the PreInsertEventListener is not only poorly documented in the javadoc (see HHH-1942 and HHH-3237) but also, the DefaultSaveOrUpdateEventListener is ran first after which the Nullability engine checks for constraints in the hbm file and *then* the defined PreInsertEventListener code is executed. This had to be learned by painful debugging when clear documentation could avoid this. The intent was to run the PreInsertEventListener to avoid the not-null constraint, but obviously this is not possible with the current design.
--
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
17 years, 3 months
[Hibernate-JIRA] Created: (HHH-2958) Incomplete/non-informative javadocs for events system
by Jacob L E Blain Christen (JIRA)
Incomplete/non-informative javadocs for events system
-----------------------------------------------------
Key: HHH-2958
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2958
Project: Hibernate3
Issue Type: Task
Components: documentation
Affects Versions: 3.2.5, 3.2.4.sp1, 3.2.4, 3.2.3, 3.2.2, 3.2.1, 3.2.0.ga, 3.2.0.cr5, 3.2.0.cr4, 3.2.0.cr3, 3.2.0.cr2, 3.2.0 cr1, 3.1.3, 3.2.0.alpha2, 3.2.0.alpha1, 3.1.2, 3.1.1, 3.1, 3.1 rc3, 3.1 rc2, 3.1 rc 1, 3.1 beta 2, 3.1 beta 1, 3.0.5
Reporter: Jacob L E Blain Christen
Priority: Minor
See also HHH-1942.
As per the documentation at http://www.hibernate.org/hib_docs/v3/api/org/hibernate/event/PreUpdateEve... (as an example) and HHH-1942 I most definately do not consider <pre><code>org.hibernate.event
Interface PreUpdateEventListener
All Superinterfaces:
Serializable
All Known Implementing Classes:
JACCPreUpdateEventListener
public interface PreUpdateEventListener extends Serializable
Called before updating the datastore
Author:
Gavin King
Method Summary
boolean onPreUpdate(PreUpdateEvent event)
Method Detail
onPreUpdate
public boolean onPreUpdate(PreUpdateEvent event)</code></pre> to be "documented" in any meaningful sense. It would be terrific if the event system javadocs as a whole were on par with the quality of the core hibernate javadocs.
--
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
17 years, 3 months
[Hibernate-JIRA] Commented: (HHH-817) Aggregate projection aliases should not be applied to where-clause
by jazir malik (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-817?page=co... ]
jazir malik commented on HHH-817:
---------------------------------
I agree, I can't see how this issue can be minor and still untouched after such a long time.
> Aggregate projection aliases should not be applied to where-clause
> ------------------------------------------------------------------
>
> Key: HHH-817
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-817
> Project: Hibernate3
> Issue Type: Bug
> Components: core
> Affects Versions: 3.0.5
> Environment: Oracle 9.2.0.6, Hibernate 3.0.5, Spring Framework 1.2.2 based application working on Jakarta Tomcat 5.0.28
> Reporter: Michal Jastak
> Priority: Minor
> Attachments: HHH-817.patch
>
>
> following java code:
> protected Entity loadEntityLightweight(Serializable entityId) throws DataAccessException {
> Criteria criteria = getSession().createCriteria(Entity.class);
> ProjectionList projectionList = Projections.projectionList();
> projectionList.add(Property.forName(BaseEntity.PROP_ID), BaseEntity.PROP_ID);
> projectionList.add(Property.forName(BaseEntity.PROP_TYPE), BaseEntity.PROP_TYPE);
> criteria.setProjection(projectionList);
> criteria.add(Restrictions.eq(BaseEntity.PROP_ID, entityId));
> criteria.setResultTransformer(new AliasToBeanResultTransformer(Entity.class));
> return (Entity) criteria.uniqueResult();
> }
> generates following SQL query:
> select this_.id as y0_, this_.type as y1_ from entities this_ left outer join facilities this_1_ on this_.id=this_1_.id left outer join users this_2_ on this_.id=this_2_.id left outer join addresses address2_ on this_.address_id=address2_.id left outer join entities entity3_ on this_2_.employer_id=entity3_.id left outer join facilities entity3_1_ on entity3_.id=entity3_1_.id left outer join users entity3_2_ on entity3_.id=entity3_2_.id where y0_=?
> y0_ = ? expression in where clause is causing a 904 error on Oracle 9:
> ORA-00904: "Y0_": invalid identifier
> hibernate dialect: org.hibernate.dialect.Oracle9Dialect
> mapping for Entity class:
> <?xml version="1.0"?>
> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
> "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
> <hibernate-mapping default-lazy="false" default-cascade="save-update">
>
> <class name="Entity" table="entities" mutable="true">
> <id name="id" type="java.lang.Long" unsaved-value="null">
> <generator class="sequence">
> <param name="sequence">entities_id_seq</param>
> </generator>
> </id>
> <many-to-one name="address" class="Address" column="address_id" />
> ...
> <!--
> - Facilities
> -->
> <joined-subclass name="Facility" table="facilities">
> <key column="id" />
> ...
> <set name="users" inverse="true" lazy="true">
> <key column="facility_id" />
> <one-to-many class="User" />
> </set>
> </joined-subclass>
> <!--
> - Users
> -->
> <joined-subclass name="User" table="users" dynamic-insert="true" dynamic-update="true">
> <key column="id" />
> <many-to-one name="employer" class="Entity" column="employer_id" cascade="none" />
> ...
> <set name="userAuthorities" inverse="true" cascade="all-delete-orphan">
> <key column="user_id" />
> <one-to-many class="Authority" />
> </set>
> </joined-subclass>
> </class>
> </hibernate-mapping>
--
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
17 years, 3 months
[Hibernate-JIRA] Created: (HHH-3426) not-null="true" in a composite-element results in bad DDL for mysql 5.0 being generated.
by Patrick Moore (JIRA)
not-null="true" in a composite-element results in bad DDL for mysql 5.0 being generated.
----------------------------------------------------------------------------------------
Key: HHH-3426
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3426
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.6
Environment: mysql 5.0.51b
Reporter: Patrick Moore
* define a map with composite-elements
* the composite-element has not-null="true" properties
* the composite-element has some not-null="false" properties ( show for completeness )
* the composite-element has properties with no not-null information.
The problem:
If the composite-element property has not-null="true" then the database column is created with Null=NO but a default value of NULL
If the composite-element property has not-null="false" or no not-null property then the database column is create NULL=NO but no default value.
--------
This behavior seems wrong because
1. this composite-element is within a map. According to the documentation only if the composite-element is within a set is the composite-element required to have all non-null values.
2. if the non-null="true" the default is NULL and non-null="false" results in no default. I believe this is reversed from the correct behavior.
--------
<class name="com.amplafi.iomanagement.resources.ExternalServicesDefinition" table="RESOURCE_REPOSITORY">
<id name="entityId" column="ID" access="field">
<generator class="native"/>
</id>
<property name="namespace" column="NAMESPACE" length="30" not-null="true" access="field"/>
<property name="displayName" column="DISPLAY_NAME" not-null="true" length="100" access="field"/>
<property name="serviceId" column="SERVICE_ID" not-null="true" length="75">
<!-- may be calculated by looking at the managingService -->
</property>
<property name="serviceUrl" column="SERVICE_URI" not-null="true" length="75" access="field"/>
<property name="connectionUrl" column="CONNECTION_URI" length="75" access="field"/>
<property name="urlPattern" column="URI_PATTERN" length="75" access="field"/>
<property name="defaultAuthorizationNamespace" column="AUTH_NAMESPACE" length="30" access="field"/>
<property name="instanceNamespaceParameter" column="INST_NAMESPACE_PARAM" length="30" access="field"/>
<property name="serviceVersion" column="SERVICE_VERSION" length="30" access="field"/>
<property name="nature" column="NATURE" length="200" access="field"/>
<property name="createTime" column="CREATE_DATE" not-null="true" access="field"/>
<property name="lastUpdate" column="UPDATE_DATE" not-null="true" access="field"/>
<property name="inactiveState" column="INACTIVE" length="3" access="field">
<type name="com.amplafi.foundation.persistence.usertypes.PersistedEnumType">
<param name="enumClass">com.amplafi.foundation.InactiveState</param>
</type>
</property>
<property name="supportedResourceTypes" column="SUPPORTED_TYPES" access="field" length="50">
<type name="com.amplafi.foundation.persistence.usertypes.JsonArrayUserType">
<param name="enumClass">com.amplafi.iomanagement.file.ResourceType</param>
</type>
</property>
<map name="externalServicesDefinitionProperties" table="EXTERNAL_SERVICE_PROPERTIES" lazy="true" access="field">
<key column="EXTERNAL_SERVICES_DEFINITION" foreign-key="FK_EXTERNAL_SERVICE__EXTERNAL_SERVICE_PROPERTIES"/>
<map-key type="string" formula="AMPLAFI_KEY"/>
<composite-element class="com.amplafi.iomanagement.resources.ExternalServicesDefinitionProperty">
<property name="amplafiKey" column="AMPLAFI_KEY" length="30"/>
<property name="serviceKey" column="SERVICE_KEY" not-null="true" length="30" access="field"/>
<property name="displayName" column="DISPLAY_NAME" not-null="true" length="50"/>
<property name="description" column="DESCRIPTION" not-null="true" length="100" access="field"/>
<property name="initial" column="INITIAL_VAL" length="100" not-null="true" access="field"/>
<!-- TODO should really be Uri ... used to get things like auth codes -->
<property name="link" column="PAGELINK" length="100" not-null="false" access="field"/>
<property name="constant" column="CONSTANT" not-null="true" access="field"/>
<property name="writeRequires" column="WRITE_REQS" not-null="true" access="field"/>
<property name="readRequires" column="READ_REQS" not-null="true" access="field"/>
<property name="secret" column="SECRET" not-null="true" access="field"/>
<property name="valueHidden" column="HID_VALUE" not-null="true" access="field"/>
<property name="depends" column="DEPENDS" length="200" not-null="false" access="field"/>
</composite-element>
</map>
</class>
mysql> desc EXTERNAL_SERVICE_PROPERTIES;
+------------------------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------------------+--------------+------+-----+---------+-------+
| EXTERNAL_SERVICES_DEFINITION | bigint(20) | NO | PRI | NULL | |
| AMPLAFI_KEY | varchar(30) | NO | PRI | | |
| SERVICE_KEY | varchar(30) | NO | PRI | NULL | |
| DISPLAY_NAME | varchar(50) | NO | PRI | NULL | |
| DESCRIPTION | varchar(100) | NO | PRI | NULL | |
| INITIAL_VAL | varchar(100) | NO | PRI | NULL | |
| PAGELINK | varchar(100) | NO | PRI | | |
| CONSTANT | bit(1) | NO | PRI | NULL | |
| WRITE_REQS | bit(1) | NO | PRI | NULL | |
| READ_REQS | bit(1) | NO | PRI | NULL | |
| SECRET | bit(1) | NO | PRI | NULL | |
| HID_VALUE | bit(1) | NO | PRI | NULL | |
| DEPENDS | varchar(200) | NO | PRI | | |
+------------------------------+--------------+------+-----+---------+-------+
13 rows in set (0.00 sec)
--
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
17 years, 3 months
[Hibernate-JIRA] Created: (HHH-3425) @IndexColumn doesn't store the List index
by J (JIRA)
@IndexColumn doesn't store the List index
-----------------------------------------
Key: HHH-3425
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3425
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.6
Environment: Hibernate: 3.2.6.ga, hibernate-annotations-3.3.0.GA, MySQL: 5.0.51b-community-nt
Reporter: J
Priority: Minor
When you have a Parent class with a bidirectional one-to-many relation to a Child class (as a List), and the index column is mapped as a property in the associated entity, Hibernate will not store the index position of the List in the db. The value will stay 0 or null (depending whether you use int of Integer as index type).
Example taken directly from 2.4.6.2.3: http://www.hibernate.org/hib_docs/annotations/reference/en/html/entity.ht...
With small change, for example "order" is changed to "position", because "order" is not allowed as columnname in MySQL.
------------ PARENT --------------
package entities;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
@Entity
public class Parent {
// Properties
@Id @GeneratedValue
private Long id;
@OneToMany(mappedBy="parent")
@org.hibernate.annotations.IndexColumn(name="position")
private List<Child> children = new ArrayList<Child>();
private String name;
// Getters & Setters
public List<Child> getChildren() { return children; }
public void setChildren(List<Child> children) { this.children = children; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public Parent() {}
}
------------------
----- CHILD -----
package entities;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import org.hibernate.Session;
import persistence.HibernateUtil;
@Entity
public class Child {
// Properties
@Id @GeneratedValue
private Long id;
@Column(name="position")
private int position;
@ManyToOne
@JoinColumn(name="parent_id", nullable=false)
private Parent parent;
private String name;
// Getters & Setters
public Parent getParent() { return parent; }
public void setParent(Parent parent) { this.parent = parent; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
}
------------------------------------
------ TEST --------------
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
Parent parent = new Parent();
Child child1 = new Child();
parent.getChildren().add(child1);
child1.setParent(parent);
Child child2 = new Child();
parent.getChildren().add(child2);
child2.setParent(parent);
session.save(parent);
session.save(child1);
session.save(child2);
session.getTransaction().commit();
--------------------------
After running this, the DB will stay:
mysql> select * from child;
+----+------+----------+-----------+
| id | name | position | parent_id |
+----+------+----------+-----------+
| 1 | NULL | NULL | 1 |
| 2 | NULL | NULL | 1 |
+----+------+----------+-----------+
instead of:
mysql> select * from child;
+----+------+----------+-----------+
| id | name | position | parent_id |
+----+------+----------+-----------+
| 1 | NULL | 1 | 1 |
| 2 | NULL | 2 | 1 |
+----+------+----------+-----------+
See also:
http://forum.hibernate.org/viewtopic.php?p=2392563
--
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
17 years, 3 months
[Hibernate-JIRA] Commented: (HHH-1829) Allow join on any property using property-ref
by Dave Smith (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1829?page=c... ]
Dave Smith commented on HHH-1829:
---------------------------------
This issue still doesn't appear to be fixed in 3.3.0.CR2. I've found the absence of this feature to be a real inconvenience when mapping to legacy schemas, however I'm starting to wonder if it is ever going to get fixed - its now more than two years since the issue was raised.
> Allow join on any property using property-ref
> ---------------------------------------------
>
> Key: HHH-1829
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1829
> Project: Hibernate3
> Issue Type: New Feature
> Components: metamodel
> Affects Versions: 3.2.0 cr1, 3.2.0.cr2
> Reporter: Maarten Winkels
> Assignee: Steve Ebersole
> Attachments: AbstractJoinTest.java, HHH-1829-mwinkels.patch, hhh-1829.patch, JoinNoPropertyRefTest.java, JoinPropertyRefTest.java, Person.hbm.xml, Person.java, PersonNoPropertyRef.hbm.xml
>
>
> Currently joining tables for one class (uing the <join...> tag) is only supported for the id property. The property-ref is allowed on the <key..> tag inside the <join..> tag, but this is ignored.
--
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
17 years, 3 months