[Hibernate-JIRA] Created: (HHH-7003) Scale = 0 doesn't supported
by R. Gainullin (JIRA)
Scale = 0 doesn't supported
---------------------------
Key: HHH-7003
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-7003
Project: Hibernate ORM
Issue Type: Bug
Components: envers
Affects Versions: 4.0.1
Reporter: R. Gainullin
If Audited entity consist Column with scale equals zero than Revision table create column with default scale value
Entity class:
@Entity
@Audited
public class Ent {
@Column(scale=0,precision=20)
private BigInteger field1;
....
}
For Postresql revision table:
Table Ent_AUD{
field1 numeric(20, 2)
}
Probably error in file
org.hibernate.envers.configuration.metadata.MetadataTools.java
in method
public static Element addColumn(...) {
...
if (scale != 0) {
column_mapping.addAttribute("scale", Integer.toString(scale));
}
...
}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 11 months
[Hibernate-JIRA] Created: (HHH-7253) NPE thrown by NaturalIdResolutionCache
by Strong Liu (JIRA)
NPE thrown by NaturalIdResolutionCache
--------------------------------------
Key: HHH-7253
URL: https://hibernate.onjira.com/browse/HHH-7253
Project: Hibernate ORM
Issue Type: Bug
Components: core
Affects Versions: 4.1.2
Reporter: Strong Liu
Fix For: 4.1.3
two tests are failling on oracle:
{quote}org.hibernate.test.generatedkeys.seqidentity.SequenceIdentityTest.testSequenceIdentityGenerator
Failing for the past 5 builds (Since #14 )
Took 0.68 sec.
Error Message
java.lang.NullPointerException
Stacktrace
java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
at org.hibernate.engine.internal.NaturalIdXrefDelegate$NaturalIdResolutionCache.cache(NaturalIdXrefDelegate.java:454)
at org.hibernate.engine.internal.NaturalIdXrefDelegate.cacheNaturalIdCrossReference(NaturalIdXrefDelegate.java:92)
at org.hibernate.engine.internal.StatefulPersistenceContext$1.manageLocalNaturalIdCrossReference(StatefulPersistenceContext.java:1769)
at org.hibernate.action.internal.AbstractEntityInsertAction.handleNaturalIdPreSaveNotifications(AbstractEntityInsertAction.java:184)
at org.hibernate.action.internal.AbstractEntityInsertAction.<init>(AbstractEntityInsertAction.java:75)
at org.hibernate.action.internal.EntityIdentityInsertAction.<init>(EntityIdentityInsertAction.java:55)
at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:317)
at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:287)
at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:193)
at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:126)
at
org.hibernate.test.generatedkeys.select.SelectGeneratorTest.testJDBC3GetGeneratedKeysSupportOnOracle
Failing for the past 5 builds (Since #14 )
Took 0.87 sec.
Error Message
java.lang.NullPointerException
Stacktrace
java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
at org.hibernate.engine.internal.NaturalIdXrefDelegate$NaturalIdResolutionCache.cache(NaturalIdXrefDelegate.java:454)
at org.hibernate.engine.internal.NaturalIdXrefDelegate.cacheNaturalIdCrossReference(NaturalIdXrefDelegate.java:92)
at org.hibernate.engine.internal.StatefulPersistenceContext$1.manageLocalNaturalIdCrossReference(StatefulPersistenceContext.java:1769)
at org.hibernate.action.internal.AbstractEntityInsertAction.handleNaturalIdPreSaveNotifications(AbstractEntityInsertAction.java:184)
at org.hibernate.action.internal.AbstractEntityInsertAction.<init>(AbstractEntityInsertAction.java:75)
at org.hibernate.action.internal.EntityIdentityInsertAction.<init>(EntityIdentityInsertAction.java:55)
at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:317)
at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:287)
at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:193)
at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:126)
at
{quote}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 11 months
[Hibernate-JIRA] Created: (HHH-7264) CLOB Length Set to 255 By Default With Derby DB
by ian mockford (JIRA)
CLOB Length Set to 255 By Default With Derby DB
-----------------------------------------------
Key: HHH-7264
URL: https://hibernate.onjira.com/browse/HHH-7264
Project: Hibernate ORM
Issue Type: Bug
Components: core
Affects Versions: 4.0.1
Environment: Derby 10.8.2.2
Reporter: ian mockford
Attachments: hibernate-derby-test.zip
When using JPA/Hibernate with a Derby DB, an @Lob annotation on a String gets truncated to a max of 255 chars.
For example:
private String message;
@Lob
@Column(name = "MESSAGE")
public String getMessage() {
return message;
}
Attached is a Maven project with a test case showing the problem; the Derby can be changed to H2 to make the tests pass.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 11 months
[Hibernate-JIRA] Created: (HHH-7251) PostgreSQL Dialect not properly mapping SQL error codes for pessimistic lock exceptions.
by Bryan Varner (JIRA)
PostgreSQL Dialect not properly mapping SQL error codes for pessimistic lock exceptions.
----------------------------------------------------------------------------------------
Key: HHH-7251
URL: https://hibernate.onjira.com/browse/HHH-7251
Project: Hibernate ORM
Issue Type: Bug
Components: core
Affects Versions: 4.1.2, 3.6.10
Environment: PostgreSQL
Reporter: Bryan Varner
Attachments: Postgres91Dialect.java
Using Hibernate-entitymanager in a JPA 2.0 environment,
{code}
Map<String, Object> params = new HashMap<String, Object>();
params.put("javax.persistence.lock.timeout", 0);
entityManager.find(Foo.class, id, LockModeType.PESSIMISTIC_WRITE, params);
{code}
Will emit the proper SQL (with FOR UPDATE NOWAIT), however if the lock is not available, it results in throwing PersistenceException instead of PessimisticLockException or LockTimeoutException.
I see that the SQL exception mapping code seems to be in a state of flux, where more of the handling is being pushed into delegates provided by the respective dialects. I highly approve of this approach, however it doesn't help me, since my transactions are being marked rollback only when a recoverable lock error (timeout) occurs.
I'm attaching my solution, which is a quick and dirty custom dialect which properly maps PostgreSQL lock exceptions back to the proper Hibernate exceptions, which are then translated into the proper JPA exceptions.
I know this issue existed in 3.6.10 (which is why I upgraded to 4.1.2 today). I do not know if the dialect-specific bits are in 3.6, but it appears the 'old' location for these types of error-code checks are in the SQLStateConversionDelegate, they could easily be added there.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 11 months
[Hibernate-JIRA] Created: (HHH-7258) NaturalIdCacheKey equals method doesn't work for primitive array types
by Steve Ash (JIRA)
NaturalIdCacheKey equals method doesn't work for primitive array types
----------------------------------------------------------------------
Key: HHH-7258
URL: https://hibernate.onjira.com/browse/HHH-7258
Project: Hibernate ORM
Issue Type: Bug
Components: core
Affects Versions: 4.1.2
Environment: Hibernate 4.1.2
SQL 2008
Reporter: Steve Ash
I have entities like (shorthand):
{code}
@Entity
@Cache
public class Parent {
@Id
private byte[] id;
}
@Entity
@Cache
@NaturalIdCache
public class Child {
@Id
private byte[] id;
@ManyToOne
@NaturalId
private Parent parent;
@NaturalId
private String name;
}
{code}
So the naturalId is a compound key made up of a FK reference to the parent + the name of the child (i.e. for a single parent, all of the childrens names are unique).
I always get a cache miss in the 2nd level cache when I try to load this by natural key using something like:
{code}
Parent p = ... // attached parent instance
return sf.getCurrentSession()
.byNaturalId(Child.class)
.using("parent", p)
.using("name", childName)
.load();
{code}
I stepped through the code and found that eventually an instance of {{NaturalIdCacheKey}} is built with a field {{naturalIdValues}}. In the Child instance above this naturalIdValues would be an array of size 2. The [0] element is a byte[] reference, and the [1] element is the child name string.
While I can see in the debugger that my Child instance is present in the natural Id cache, the equals method on NaturalIdCacheKey just uses Array.equals on naturalIdValues. Thus, it does a reference equals on my primitive byte[] for the parent's PK value. While the values in the byte array are the same, they are different instances of course, and thus the reference equals returns false, and I never retrieve this from the natural id cache.
Thinking I would be clever, I replaced this with an @Embeddable component that wrapped the byte[] and implemented my own equals, but Hibernate core _disassembles_ the component to build the naturalIdCacheKey which defeats my component and so we end up with the same problem.
I have run in to a similar problem in HHH-7180 so clearly theres not too many of us that are using binary storage for GUIDs. Is everyone else just storing as 32byte strings? Or 22 byte case-sensitive coalation strings? Or an @embedded with two longs?
I'll build a test case that replicates this at some point soon.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 11 months