[Hibernate-JIRA] Created: (HBX-945) CLONE -hbm2java does not generate correct POJO property types for UserType columns
by Brill Pappin (JIRA)
CLONE -hbm2java does not generate correct POJO property types for UserType columns
----------------------------------------------------------------------------------
Key: HBX-945
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-945
Project: Hibernate Tools
Issue Type: Bug
Components: hbm2java
Affects Versions: 3.1alpha5
Environment: Pulled from CVS somewhere between 3.1a5 and 3.1b1
Reporter: Brill Pappin
Fix For: 3.1beta2
I have defined my own custom UserType (which coincidentally maps a DB2 decimal field to a java.sql.Date property, using some special formatting...).
My mapping file contains:
<property name="connectDate" type="DecimalDateType">
<column name="UMPCN" precision="8" scale="0" not-null="true" />
</property>
where DecimalDateType is the fully-qualified name of my UserType class.
The POJO generated contains the property:
private DecimalDateType connectDate;
This is incorrect. It SHOULD have generated a property of the type returned by DecimalDateType.returnedClass() (which in this case is java.sql.Date.class). ie. It should have been
private java.sql.Date connectDate;
The "decision" of which type to generate (ie where the error manifests itself) error appears to be in
Cfg2JavaTool.java
in the method
private String getJavaTypeName(Value value, boolean preferRawTypeNames)
I am not sure of the exact fix, since there appear to be other checks being done, and I do not understand all the logic here.
Thanks!
james
--
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, 5 months
[Hibernate-JIRA] Created: (HBX-957) generated @SequenceGenerator annotation does not support customization of sequence table name
by Martin Serrano (JIRA)
generated @SequenceGenerator annotation does not support customization of sequence table name
---------------------------------------------------------------------------------------------
Key: HBX-957
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-957
Project: Hibernate Tools
Issue Type: Bug
Components: hbm2java
Affects Versions: 3.2beta9
Environment: 3.2.2ga
Reporter: Martin Serrano
Priority: Minor
The tools documentation has an example (reproduced below) which implies that you should be able to specify the table used for id generation via sequences. The "table" property is never used in the creation of the @SequenceGenerator annotation. You get @SequenceGenerator(name="generator") instead of the expected @SequenceGenerator(name="seq_table"). I'll be submitting a patch soon.
<!-- table allows you to override/define how reverse engineering
are done for a specific table -->
<table name="ORDERS">
<primary-key>
<!-- setting up a specific id generator for a table -->
<generator class="sequence">
<param name="table">seq_table</param>
</generator>
<column name="CUSTID"/>
</primary-key>
<column name="NAME" property="orderName" type="string" />
<!-- control many-to-one and set names for a specific named foreign key constraint -->
<foreign-key constraint-name="ORDER_CUST">
<many-to-one property="customer"/>
<set property="orders"/>
</foreign-key>
</table>
--
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, 5 months
[Hibernate-JIRA] Created: (HHH-2690) Cascade delete and ternary association after upgrade
by Przemek Dyk (JIRA)
Cascade delete and ternary association after upgrade
----------------------------------------------------
Key: HHH-2690
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2690
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.4.sp1, 3.2.4, 3.2.3, 3.2.2, 3.2.1
Environment: hsqldb, jvm 1.6.0_01-ea, ubuntu
Reporter: Przemek Dyk
Attachments: manytest.zip
My classes:
public class Product {
private long id;
private String name;
private Map/*<Attribute,AttributeValue>*/ attributeValues;
//getters/setters/hashcode/equals
}
public class AttributeValue {
private long id;
private String value;
private Product product;
private Attribute attribute;
//getters/setters/hashcode/equals
}
public class Attribute {
private long id;
private String name;
//getters/setters/hashcode/equals
}
Fragment of mapping:
<class name="Product">
<id name="id" column="id" type="long" unsaved-value="0">
<generator class="native"/>
</id>
<property name="name" not-null="true"/>
<map name="attributeValues" lazy="true" inverse="false" cascade="all-delete-orphan">
<key column="product_id" not-null="true"/>
<map-key-many-to-many column="attribute_id" class="Attribute"/>
<one-to-many class="AttributeValue"/>
</map>
</class>
... and my exception after upgrading hibernate in my application.
2007-06-27 20:08:54 org.hibernate.property.BasicPropertyAccessor$BasicGetter get
SEVERE: IllegalArgumentException in class: com.mycompany.Attribute, getter method of property: id
org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of com.mycompany.Attribute.id
at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:171)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:183)
at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3591)
at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:3307)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:181)
at org.hibernate.engine.ForeignKeys$Nullifier.isNullifiable(ForeignKeys.java:137)
at org.hibernate.engine.ForeignKeys$Nullifier.nullifyTransientReferences(ForeignKeys.java:69)
at org.hibernate.engine.ForeignKeys$Nullifier.nullifyTransientReferences(ForeignKeys.java:47)
at org.hibernate.event.def.DefaultDeleteEventListener.deleteEntity(DefaultDeleteEventListener.java:248)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:141)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:775)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:758)
at org.hibernate.engine.CascadingAction$2.cascade(CascadingAction.java:121)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:296)
at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
at org.hibernate.event.def.DefaultDeleteEventListener.cascadeBeforeDelete(DefaultDeleteEventListener.java:307)
at org.hibernate.event.def.DefaultDeleteEventListener.deleteEntity(DefaultDeleteEventListener.java:246)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:141)
at org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:52)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:766)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:744)
I've tried many versions of hibernate using test from attachment
( mvn -Dhibernate.version=<version> clean compile test ) and I think that
bug was introduced between 3.2.0.ga and 3.2.1.ga
--
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, 5 months
[Hibernate-JIRA] Created: (HHH-2160) JTATransactionFactory.isTransactionInProgress fails with WebSphereExtendedJTATransactionLookup
by Timothy Folks (JIRA)
JTATransactionFactory.isTransactionInProgress fails with WebSphereExtendedJTATransactionLookup
----------------------------------------------------------------------------------------------
Key: HHH-2160
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2160
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.0.ga
Environment: Hibernate 3.2.0 ga
WebSphere Application Server 6.0.2.15
DB2 9.1
Reporter: Timothy Folks
Configurating Hibernate with the following settings:
hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory
hibernate.transaction.manager_lookup_class=org.hibernate.transaction.WebSphereExtendedJTATransactionLookup
jta.UserTransaction=java:comp/UserTransaction
hibernate.current_session_context_class=jta
results in the following stack trace (irrelevant lines snipped)
<snipped>
Caused by: org.hibernate.TransactionException: could not register synchronization with JTA TransactionManager
at org.hibernate.jdbc.JDBCContext.registerSynchronizationIfPossible(JDBCContext.java:181)
at org.hibernate.jdbc.JDBCContext.<init>(JDBCContext.java:76)
at org.hibernate.impl.SessionImpl.<init>(SessionImpl.java:213)
at org.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:525)
at org.hibernate.context.JTASessionContext.buildOrObtainSession(JTASessionContext.java:114)
at org.hibernate.context.JTASessionContext.currentSession(JTASessionContext.java:80)
at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:542)
<snipped>
Caused by: java.lang.UnsupportedOperationException
at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter.getStatus(WebSphereExtendedJTATransactionLookup.java:78)
at org.hibernate.transaction.JTATransactionFactory.isTransactionInProgress(JTATransactionFactory.java:94)
at org.hibernate.jdbc.JDBCContext.isTransactionInProgress(JDBCContext.java:187)
at org.hibernate.jdbc.JDBCContext.registerSynchronizationIfPossible(JDBCContext.java:159)
The workaround I've implemented is to change the following line in JTATransactionFactory.isTransactionInProgress:
if ( jdbcContext.getFactory().getTransactionManager() != null ) {
to:
if ( jdbcContext.getFactory().getTransactionManager() != null && jdbcContext.getFactory().getTransactionManager() instanceof WebSphereExtendedJTATransactionLookup.TransactionManagerAdapter == false) {
This results in the method falling back to looking up the UserTransaction in JNDI and calling getStatus on that.
--
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, 5 months
[Hibernate-JIRA] Commented: (ANN-210) @ManyToOne not working wth @Formula
by Emmanuel Bernard (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-210?page=co... ]
Emmanuel Bernard commented on ANN-210:
--------------------------------------
Hi George,
Where you able to work on this one?
> @ManyToOne not working wth @Formula
> -----------------------------------
>
> Key: ANN-210
> URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-210
> Project: Hibernate Annotations
> Issue Type: Improvement
> Components: binder
> Affects Versions: 3.1beta7
> Environment: Hibernate 3.1, PostgreSQL 8.1.1
> Reporter: Jason Long
>
> This type of mapping fails:
> @ManyToOne
> @Formula(value="( select v_pipe_offerprice.offerprice_fk from v_pipe_offerprice where v_pipe_offerprice.id = id )")
> public OfferPrice getOfferPrice() { return offerPrice; }
> While the following mapping works as expected:
> <class name="Pipe" table="t_pipe">
> ...
> <many-to-one name="offerPrice"
> class="pipetracker.model.price.OfferPrice"
> formula="( select v_pipe_offerprice.offerprice_fk
> from v_pipe_offerprice
> where v_pipe_offerprice.id = id )"/>
> ...
> </class>
> This is not being treated as a formula because the generated SQL included a referece to the field pipe.offerprice_id which does not exsist because this is a virtual column calculated from a view.
--
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, 5 months
[Hibernate-JIRA] Created: (HHH-2706) Add debugging option for detecting if a Session is unclosed
by Mike Quilleash (JIRA)
Add debugging option for detecting if a Session is unclosed
-----------------------------------------------------------
Key: HHH-2706
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2706
Project: Hibernate3
Issue Type: New Feature
Components: core
Affects Versions: 3.2.1
Environment: Any
Reporter: Mike Quilleash
In H2 the Session would log a warning if close was not called. This was removed in H3 due to performance issues of using a finalizer.
It can often be very difficult to track down unclosed Sessions so I would like to propose an option be added for restoring this functionality with an enhancement.
Add a Session implementation that wraps another Session which will
- Pass through all methods.
- Create but not throw an Exception on creation
- Watch for "closure" methods and record as appropriate.
- Have a finalizer that checks for the Session not being closed and logs a warning and the exception created with the Session's stacktrace.
Then on any Session creation by SessionFactory, if the option is enabled, wrap the Session with the wrapper above.
This will have performance implications because of the finalizer and the Exception creation per Session. But as a debugging tool it could be very useful.
I am open to creating a patch if there is interest.
--
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, 5 months