[Hibernate-JIRA] Created: (HHH-3151) using property-ref and not-null="true" simultaneously in collection <key> element crashes with ArgumentIllegalException
by boris schukin (JIRA)
using property-ref and not-null="true" simultaneously in collection <key> element crashes with ArgumentIllegalException
-----------------------------------------------------------------------------------------------------------------------
Key: HHH-3151
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3151
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.5
Environment: hibernate 3.2.5
Reporter: boris schukin
Example:
Let's we have one class "MetaMethod" and second class "MetaParameter" .
Class MetaMethod has a list of MetaParameters.
Corresponding tables are:
CREATE TABLE META_METHOD
(ID VARCHAR2(50) NOT NULL
,CODE VARCHAR2(40) NOT NULL
,BCN_CODE VARCHAR2(40) NOT NULL
,NAME VARCHAR2(100)
)
ALTER TABLE META_METHOD ADD (CONSTRAINT SK_BFN_PK PRIMARY KEY (ID))
ALTER TABLE META_METHOD ADD (CONSTRAINT SK_BFN_UK1 UNIQUE (CODE ,BCN_CODE))
CREATE TABLE META_PARAMETER
(ID VARCHAR2(50) NOT NULL
,BFN_CODE VARCHAR2(40) NOT NULL
,BCN_CODE VARCHAR2(40) NOT NULL
,SEQUENCE_NUMBER NUMBER(4,0) NOT NULL
,TYPE VARCHAR2(255) NOT NULL
)
ALTER TABLE META_PARAMETER ADD (CONSTRAINT SK_BFA_PK PRIMARY KEY (ID))
ALTER TABLE META_PARAMETER ADD (CONSTRAINT SK_BFA_UK1 UNIQUE (BFN_CODE, BCN_CODE ,SEQUENCE_NUMBER))
ALTER TABLE META_PARAMETER ADD (CONSTRAINT SK_BFA_BFN_FK1 FOREIGN KEY (BFN_CODE ,BCN_CODE) REFERENCES META_METHOD (CODE ,BCN_CODE))
You see, the foreign key (BFN_CODE ,BCN_CODE) on the table META_PARAMETER is organized by native key (CODE ,BCN_CODE) of the META_METHOD table.
Structure of classes is simple (in my opinion), so i introduce the hibernate mappings:
<class name="com.stinscoman.kernel.api.meta.MetaMethod"
table="META_METHOD" >
<id name="id" column="ID" length="40" type="long">
<generator class="assigned" />
</id>
<properties name="theKey" unique="true">
<property name="code" column="CODE" not-null="true"/>
<property name="bc" column="BCN_CODE" not-null="true" />
</properties>
<property name="name" column="NAME" />
<list name="parameters" cascade="all-delete-orphan">
<key property-ref="theKey" not-null="true" update="false">
<column name="BFN_CODE" not-null="true"/>
<column name="BCN_CODE" not-null="true"/>
</key>
<list-index column="SEQUENCE_NUMBER" />
<one-to-many class="com.stinscoman.kernel.api.meta.MetaParameter"/>
</list>
</class>
<class name="com.stinscoman.kernel.api.meta.MetaParameter"
table="SK_BFN_ARGUMENT">
<id name="id" column="ID" length="40" type="long">
<generator class="assigned"/>
</id>
</class>
Now, somewhere in hibernate session, i try to put a parameter to method
MetaMethod method = ... <the code to obtain MetaMethod object>
MetaParameter param = ... <the code to obtain MetaParameter object>
method.getParameters().add( param );
Ok. When session is flushing i always have:
Caused by: org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of com.stinscoman.kernel.api.meta.MetaMethod.code
at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:171)
at org.hibernate.tuple.component.AbstractComponentTuplizer.getPropertyValue(AbstractComponentTuplizer.java:64)
at org.hibernate.tuple.component.AbstractComponentTuplizer.getPropertyValues(AbstractComponentTuplizer.java:70)
at org.hibernate.tuple.component.PojoComponentTuplizer.getPropertyValues(PojoComponentTuplizer.java:83)
at org.hibernate.type.ComponentType.getPropertyValues(ComponentType.java:353)
at org.hibernate.type.ComponentType.getPropertyValues(ComponentType.java:348)
at org.hibernate.engine.ForeignKeys$Nullifier.nullifyTransientReferences(ForeignKeys.java:77)
at org.hibernate.engine.ForeignKeys$Nullifier.nullifyTransientReferences(ForeignKeys.java:47)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:282)
...
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@75a0c6
at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:145)
... 70 more
As i understand, the problem is in property-ref and not-null="true" simultaneously in collection <key> element.
--
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
16 years, 1 month
[Hibernate-JIRA] Created: (HHH-3614) Version Tagging
by Corneil du Plessis (JIRA)
Version Tagging
---------------
Key: HHH-3614
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3614
Project: Hibernate Core
Issue Type: New Feature
Components: envers
Reporter: Corneil du Plessis
I would like to suggest a new feature for version tagging in envers.
I have a suggestion for how it can be implemented.
@Versioned
@Taggable
public class MyEntity {
@Id
private Long id;
@Basic
String someProp;
}
By implication results in @RevisionTagEntity which can be seen as
public class MyEntity_tag {
@RevisionNumber
private Integer version_numer;
@RevisionTagTimestamp
private long tag_date;
@RevisionTagValue
private String tag; // Other @Colum can apply as well as using Integer or Enum
// Other properties allow like with @RevisionEntity
}
This produces a table like:
create table MyEntity_tags (
id bigint not null,
version_number integer not null, // version_number is _revision
tag_date timestamp not null, // assigned when create or modified
version_tag varchar(255) not null, // Could be customizable with RevisionTagEntity similar to RevisionEntity
primary key (id, version_tag),
);
EntityTagging will be a utility class using EntityManager and Entity or Collection of Entities and do:
tagLatestVersion(Object entity, String tag)
tagVersion(Object entity, Integer version, String tag)
moveTag(Object entity, String targetVersion, String tag)
determineVersion(Object entity, String tag)
The following could be added to allow the retrieval of versions of collections of entities that are tagged in a specific way.
RevisionProperty.tag(String tag)
--
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
16 years, 1 month
[Hibernate-JIRA] Updated: (HHH-1877) ClassNotFoundException on my entity-name in a join tag
by Guillaume Jeudy (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1877?page=c... ]
Guillaume Jeudy updated HHH-1877:
---------------------------------
Attachment: HBM-1877-testcase.zip
put this testcase in hibernate-testsuite module in hibernate core. It should run successfully there.
> ClassNotFoundException on my entity-name in a join tag
> ------------------------------------------------------
>
> Key: HHH-1877
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1877
> Project: Hibernate Core
> Issue Type: Bug
> Affects Versions: 3.1.3
> Environment: Hibernate 3.1.3, Spring 1.2.8, Oracle 9I, Windows XP (localhost)
> Reporter: Christian Mineau
> Attachments: HBM-1877-patch.patch, HBM-1877-testcase.zip, HHH-1877.patch, testcase-HHH1877.ZIP
>
>
> I use the attribute "entity-name" in my class mapping, this is for mapping the same object many times on table(s), and all seem to work normally. I found a problem when I tried to join a table on another class mapping, like:
> <class entity-name="categoryDefault" name="ca.cie.pak.CategoryVO" table="CATEGORY">
> <id name="id" column="CATEGORY_ID" type="java.lang.Integer">
> <generator class="native"/>
> </id>
> <property name="name" column="NAME"/>
>
> <bag name="contents" where="priority = 0">
> <key column="CATEGORY_ID" />
> <one-to-many entity-name="ContentSummary"/>
> </bag>
>
> <join table="LAYOUT_CATEGORY">
> <key foreign-key="CATEGORY_ID" column="CATEGORY_ID" />
> <property name="layoutId" column="LAYOUT_ID"/>
> </join>
> </class>
> I found a ClassNotFoundException: categoryDefault. This exception is thrown when the HbmBinder.bindJoin method is called. I see the code and it tries to instantiate a class from the getEntityName and not by the className.
> Someone can answer me if this is a XML mapping error or a real bug and what I need to do.
--
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
16 years, 1 month
[Hibernate-JIRA] Updated: (HHH-1877) ClassNotFoundException on my entity-name in a join tag
by Guillaume Jeudy (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1877?page=c... ]
Guillaume Jeudy updated HHH-1877:
---------------------------------
Attachment: HBM-1877-patch.patch
Patch based on current trunk.
> ClassNotFoundException on my entity-name in a join tag
> ------------------------------------------------------
>
> Key: HHH-1877
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1877
> Project: Hibernate Core
> Issue Type: Bug
> Affects Versions: 3.1.3
> Environment: Hibernate 3.1.3, Spring 1.2.8, Oracle 9I, Windows XP (localhost)
> Reporter: Christian Mineau
> Attachments: HBM-1877-patch.patch, HHH-1877.patch, testcase-HHH1877.ZIP
>
>
> I use the attribute "entity-name" in my class mapping, this is for mapping the same object many times on table(s), and all seem to work normally. I found a problem when I tried to join a table on another class mapping, like:
> <class entity-name="categoryDefault" name="ca.cie.pak.CategoryVO" table="CATEGORY">
> <id name="id" column="CATEGORY_ID" type="java.lang.Integer">
> <generator class="native"/>
> </id>
> <property name="name" column="NAME"/>
>
> <bag name="contents" where="priority = 0">
> <key column="CATEGORY_ID" />
> <one-to-many entity-name="ContentSummary"/>
> </bag>
>
> <join table="LAYOUT_CATEGORY">
> <key foreign-key="CATEGORY_ID" column="CATEGORY_ID" />
> <property name="layoutId" column="LAYOUT_ID"/>
> </join>
> </class>
> I found a ClassNotFoundException: categoryDefault. This exception is thrown when the HbmBinder.bindJoin method is called. I see the code and it tries to instantiate a class from the getEntityName and not by the className.
> Someone can answer me if this is a XML mapping error or a real bug and what I need to do.
--
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
16 years, 1 month
[Hibernate-JIRA] Commented: (HHH-663) Enabling filters for get(), load(), ... - please reopen HHH-67
by Markus Merder (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-663?page=co... ]
Markus Merder commented on HHH-663:
-----------------------------------
I agree to Erico, it's not clear, that filters only work for HQL-Queries. Maybe Filters should be called HQLFilter instead. I have experienced some applications, which could not use filters due to the lack of filtering every statement (also on update, delete).
> Enabling filters for get(), load(), ... - please reopen HHH-67
> --------------------------------------------------------------
>
> Key: HHH-663
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-663
> Project: Hibernate Core
> Issue Type: Improvement
> Components: core
> Affects Versions: 3.0.5
> Reporter: Michael Wyraz
>
> Hibernate filters apply only to queries, not to load/get by id. This was also postet as bug HHH-67. This bug was rejected with the reason "This is by intent and thus not a bug."
> The Hibernate documentation says for Filters: "Filters can be used like database views, but parameterized inside the application.". The filter is attached to a class or a collection.
> So in my oppinion there's no reason _not_ to use filters with get() or load(). In fact, that's what users expect after reading the documentation.
> So the current behaviour is a bug. Either in hibernate or in the documentation.
> Michael.
--
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
16 years, 1 month