[Hibernate-JIRA] Created: (ANN-825) TestCase could check for superclass of Dialect before skipping it
by Juraci Paixao Krohling (JIRA)
TestCase could check for superclass of Dialect before skipping it
-----------------------------------------------------------------
Key: ANN-825
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-825
Project: Hibernate Annotations
Issue Type: Improvement
Reporter: Juraci Paixao Krohling
Assignee: Hardy Ferentschik
Attachments: ANN-CheckSuperclassDialectsBeforeSkip.diff
If a subclass of org.hibernate.test.annotations.TestCase is annotated with @RequiresDialect (or any of its methods), TestCase tries to match the exact name of the dialect in order to decide to skip it or not.
My suggestion (and the attached patch) adds another check. If I specify the superclass of a set of dialects (like Oracle8iDialect, which is superclass of Oracle9i and Oracle10g), the test won't skip the subclasses of Oracle8iDialect.
How to reproduce:
1) Create a test case annotated with @RequiresDialect(Oracle8iDialect.class)
2) Configure the test to run using the Oracle9iDialect
3) The test will be skipped, even though Oracle9iDialect is a subclass of Oracle8iDialect
After the patch, the step 3 would be:
3) The test is not skipped.
If there's a reason to not check the superclasses, please reject this JIRA. Otherwise, please review it and commit (or assign it back to me to commit).
--
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
15 years, 1 month
[Hibernate-JIRA] Created: (ANN-593) Ability for an @NamedQuery on a @MappedSuperclass to be copied up to the subclass
by John Newman (JIRA)
Ability for an @NamedQuery on a @MappedSuperclass to be copied up to the subclass
---------------------------------------------------------------------------------
Key: ANN-593
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-593
Project: Hibernate Annotations
Issue Type: Improvement
Components: binder
Affects Versions: 3.2.1
Environment: INFO Version:15 - Hibernate Annotations 3.2.1.GA
09:15:01,755 INFO Environment:500 - Hibernate 3.2.1
INFO SettingsFactory:81 - RDBMS: Microsoft SQL Server, version: 08.00.0760
09:15:06,114 INFO SettingsFactory:82 - JDBC driver: jTDS Type 4 JDBC Driver for MS SQL Server and Sybase, version: 1.2
09:15:06,255 INFO Dialect:151 - Using dialect: org.hibernate.dialect.SQLServerDialect
Reporter: John Newman
If I use a @MappedSuperclass (which is a very useful annotation btw) I have to manually copy any queries I want with taht class up to all subclasses. The binder should check any mapped superclasses and pull those named queries up. i.e.
/**
* Base User class that different projects user classes derive from.
* Hibernate annotations doesn't pick up that query, so you have to copy it up to your subclass
*/
@MappedSuperclass
@NamedQueries({
@NamedQuery(name="User.findByLoginName",
query="FROM User WHERE loginName = ?") // this is useless down here, i just put it here for reference
})
public class BaseUser<PK extends Serializable> extends IdEntity<PK> {
private static final long serialVersionUID = -4443522925041212381L;
protected String loginName;
@Column(unique=true)
public String getLoginName() {
return this.loginName;
}
public void setLoginName(String loginName) {
this.loginName = loginName;
}
}
/**
* Custom user class for a certain application
*/
@Entity
@Table(name="tbl_user")
@GenericGenerator(name=IdGen.NAME, strategy=IdGen.AUTO)
@NamedQueries({
@NamedQuery(name="User.findByLoginName",
query="FROM User WHERE loginName = ?") // had to copy this up from the base class
})
public class User extends BaseUser<Short> {
private static final long serialVersionUID = -6199544722824321999L;
private String firstName;
...
}
so in short it would be nice if the scanner would check for that and bind any named queries up to the subclass
--
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
15 years, 1 month
[Hibernate-JIRA] Created: (HHH-2326) NullPointerException from merge on composite id
by Greg Adams (JIRA)
NullPointerException from merge on composite id
-----------------------------------------------
Key: HHH-2326
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2326
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.1
Environment: Hibernate 3.2.1ga, tested against Oracle 10g and Derby
Reporter: Greg Adams
Priority: Critical
Attachments: HibernateMergeBug.zip
Merge is throwing an NPE from the bowels of Hibernate when I have a class mapped with a composite ID.
Stacktrace:
[junit] java.lang.NullPointerException
[junit] at org.hibernate.type.AbstractType.getHashCode(AbstractType.java:112)
[junit] at org.hibernate.type.AbstractType.getHashCode(AbstractType.java:120)
[junit] at org.hibernate.type.EntityType.getHashCode(EntityType.java:279)
[junit] at org.hibernate.type.ComponentType.getHashCode(ComponentType.java:189)
[junit] at org.hibernate.engine.EntityKey.generateHashCode(EntityKey.java:104)
[junit] at org.hibernate.engine.EntityKey.<init>(EntityKey.java:48)
[junit] at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:100)
[junit] at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:687)
[junit] at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:669)
[junit] at org.hibernate.engine.CascadingAction$6.cascade(CascadingAction.java:245)
[junit] at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
[junit] at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
[junit] at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
[junit] at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:296)
[junit] at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242)
[junit] at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219)
[junit] at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
[junit] at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
[junit] at org.hibernate.event.def.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:437)
[junit] at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:194)
[junit] at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:123)
[junit] at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:53)
[junit] at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:677)
[junit] at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:661)
[junit] at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:665)
[junit] at com.foo.test.HibernateTest.doMerge(Unknown Source)
[junit] at com.foo.test.HibernateTest.testInsert(Unknown Source)
[junit] at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
[junit] at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
[junit] at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
[junit] at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
[junit] at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
[junit] at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
[junit] at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
[junit] at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
[junit] at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
[junit] at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
[junit] at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:32)
I've attached a zipped-up project that reproduces the error. Just extract and run ant.
--
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
15 years, 1 month
[Hibernate-JIRA] Created: (ANN-626) @Generated annotation not inserting during insert
by Rob (JIRA)
@Generated annotation not inserting during insert
-------------------------------------------------
Key: ANN-626
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-626
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.3.0.ga, 3.2.0.ga
Environment: MSSQL 9.00.3042.00
Hibernate annotations version 3.2.0 GA and also tested 3.30 GA
Reporter: Rob
Priority: Critical
The @Generated annotation is not working similiar to the hbm generated tag.
Annotation Mapping:
@Generated(GenerationTime.INSERT)
@Column (name="CreatedOn", length=23, nullable=false, insertable=false, updatable=false)
private Date mCreatedOn;
Mapping Document:
<property name="createdOn" generated="insert" type="TimestampType">
<column name="CreatedOn" length="23"/>
</property>
The generated SQL (show_sql=true):
Hibernate: insert into Zone (CreatedByUserID, ZoneDescription, ZoneFile, ModifiedByUserID, ModifiedOn, ZoneName, RowStatus, SOAExpire, SOAMinimum, SOARefresh, SOARetry, SOAWho, ZoneTTL, ZoneType, ZoneClass) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Debug level Hibernate log excerpt:
18:37:42 WARN org.hibernate.util.JDBCExceptionReporter 77 SQL Error: 515, SQLState: 23000
18:37:42 ERROR org.hibernate.util.JDBCExceptionReporter 78 Cannot insert the value NULL into column 'CreatedOn', table 'DB.dbo.Zone'; column does not allow nulls. INSERT fails.
--
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
15 years, 1 month
[Hibernate-JIRA] Created: (HHH-3917) @NotFound(action=NotFoundAction.IGNORE) results in EAGER loading for @ManyToOne(fetch = FetchType.LAZY) field
by Vlasov Igor (JIRA)
@NotFound(action=NotFoundAction.IGNORE) results in EAGER loading for @ManyToOne(fetch = FetchType.LAZY) field
-------------------------------------------------------------------------------------------------------------
Key: HHH-3917
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3917
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Reporter: Vlasov Igor
Hello
I try to use @org.hibernate.annotations.NotFound(action=NotFoundAction.IGNORE) annotation to avoid of throwing an exception IN
@JoinColumn(name = "UR_ID", referencedColumnName = "UR_ID")
@ManyToOne(fetch = FetchType.LAZY)
@org.hibernate.annotations.NotFound(action=NotFoundAction.IGNORE)
@Basic(optional=true)
private UserRole role;
Then it results me to EAGER loading of this field.
Throw days of debuging i have found that:
1. @org.hibernate.annotations.NotFound results in:
isNullable()=true
for org.hibernate.type.ManyToOneType
2. in org.hibernate.impl.SessionImpl and method internalLoad i can see:
LoadEventListener.LoadType type = nullable ?
LoadEventListener.INTERNAL_LOAD_NULLABLE :
eager ? LoadEventListener.INTERNAL_LOAD_EAGER : LoadEventListener.INTERNAL_LOAD_LAZY;
Threrefore we have LoadEventListener.INTERNAL_LOAD_NULLABLE type of loading my relation. !!!
and in class org.hibernate.event.LoadEventListener.INTERNAL_LOAD_NULLABLE I can see setAllowProxyCreation(false) !!!!
3. in org.hibernate.event.def.DefaultLoadEventListener in line 218 there is a condition:
if ( options.isAllowProxyCreation() ) {
return createProxyIfNecessary( event, persister, keyToLoad, options, persistenceContext );
} else {
return load(event, persister, keyToLoad, options);
}
In my case LoadEventListener.INTERNAL_LOAD_NULLABLE.isAllowProxyCreation() ==false !!
and it results in LOADING of Object !!!
Can we set LoadEventListener.INTERNAL_LOAD_NULLABLE.isAllowProxyCreation() to true ?
org.hibernate.event.LoadEventListener.INTERNAL_LOAD_NULLABLE = new LoadType("INTERNAL_LOAD_NULLABLE")
.setAllowNulls(true)
.setAllowProxyCreation(false)
.setCheckDeleted(false)
.setNakedEntityReturned(false);
--
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
15 years, 1 month