[Hibernate-JIRA] Created: (HHH-4045) Oracle PrimaryKey and Not Null Constraint have no explicit Name
by Peter Kamm (JIRA)
Oracle PrimaryKey and Not Null Constraint have no explicit Name
---------------------------------------------------------------
Key: HHH-4045
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4045
Project: Hibernate Core
Issue Type: Improvement
Components: core
Affects Versions: 3.3.1
Environment: Oracle Dialect's
Reporter: Peter Kamm
Attachments: mapping.zip
If I have a Class like this:
@Entity
@Table(name = "ADDRESS ")
public class Address {
@Id
@Column(name = "ADDRESS_PK", nullable = false, precision = 20)
private Long Id;
@Column(name = "STREET" , nullable = false, length = 50)
private String street;
@Column(name = "ZIP_CODE" , nullable = false, length = 10)
private String zipCode;
}
I get a DDL like this:
create table ADDRESS (
ADDRESS_PK number(19,0) not null,
STREET varchar(50) not null,
ZIP_CODE varchar(10) not null,
primary key (ADDRESS_PK)
);
What I would lik to have is this:
create table ADDRESS (
ADDRESS_PK number(19,0) constraint NN4FB7B77D240AE17A not null,
STREET varchar(50) constraint NN4FB7B77DA9D7335B not null,
ZIP_CODE varchar(10) constraint NN4FB7B77DFF11B2F not null,
constraint ADDRESSPK primary key (ADDRESS_PK)
);
So that the Constraints have explicit names. This would be alot more usable for Schema comparing.
I've attached the suggestion code of the Table and PrimaryKey Class, which could be extended,
with some Dialect Methods.
--
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, 6 months
[Hibernate-JIRA] Created: (HHH-4043) automatic dirty check does not work with lobs
by Stefan Wachter (JIRA)
automatic dirty check does not work with lobs
---------------------------------------------
Key: HHH-4043
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4043
Project: Hibernate Core
Issue Type: Improvement
Affects Versions: 3.3.2, 3.3.1
Reporter: Stefan Wachter
When a lob (a blob or a clob) is modified by truncate or by setOutputStream/setCharacterStream then field is not detected as being dirty.
The reason seems to be that the BlobType and ClobType determine the dirtyness of such fields by checking object identity of the java.sql.Blob / Clob members.
Maybe the behaviour could be improved by the following way:
- Blobs and Clobs seem always to be wrapped by org.hibernate.lob.SerializableBlob / SerializableClob
- These classes could be augmented by a dirty flag that is set if truncate or setOutputStream / setCharacterStream is set
- The BlobType/ClobType should no more determine the dirtyness by checking object identity but by using this flag
--
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, 6 months
[Hibernate-JIRA] Created: (EJB-434) SQLException: ORA-02287 while fetching the sequence value
by Jerish Joseph (JIRA)
SQLException: ORA-02287 while fetching the sequence value
----------------------------------------------------------
Key: EJB-434
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-434
Project: Hibernate Entity Manager
Issue Type: Bug
Components: EntityManager
Affects Versions: 3.4.0.GA
Environment: 3.4.0.GA, Oracle 10g
Reporter: Jerish Joseph
We are getting ORA-02287 error while fetching the sequence value from database. The query executed is SELECT APP_SEQ.NEXTVAL FROM DUAL. We reveretd to an old version of hibernate-entitymanager (3.2.1.ga ) to get rid of this issue.
The exception thrown with 3.4.0.GA is:
Caused by: java.sql.SQLException: ORA-02287: sequence number not allowed here
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:74)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:131)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:204)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1034)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:791)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:866)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1186)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3387)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3431)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1203)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.pmiExecuteQuery(WSJdbcPreparedStatement.java:1011)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeQuery(WSJdbcPreparedStatement.java:661)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1808)
at org.hibernate.loader.Loader.doQuery(Loader.java:697)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.doList(Loader.java:2228)
... 196 more
--
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, 6 months
[Hibernate-JIRA] Commented: (HHH-1574) AbstractEntityPersister.getNaturalIdentifierSnapshot doesn't work with many-to-one ids
by Raymond Bourges (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1574?page=c... ]
Raymond Bourges commented on HHH-1574:
--------------------------------------
Still present in 3.3.1.ga and 3.3.2.ga
Please help. Thanks
> AbstractEntityPersister.getNaturalIdentifierSnapshot doesn't work with many-to-one ids
> --------------------------------------------------------------------------------------
>
> Key: HHH-1574
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1574
> Project: Hibernate Core
> Issue Type: Patch
> Affects Versions: 3.1.2
> Reporter: Alex Burgel
> Attachments: resolveentity.patch, resolveentity32.patch, testcase.zip
>
>
> i just upgraded from 3.0.5 to 3.1.2, and i started seeing this problem. i'm not exactly sure where the bug is here, but this is what i'm seeing:
> i have a class, Subscription, which has a natural-id of class Subscriber and Edition (excerpts of relevant mapping files below).
> when Subscription is unloaded, if i make a change, then commit the session, i see this exception:
> HibernateException: immutable natural identifier of an instance of Subscription was altered
> this gets thrown from DefaultFlushEntityEventListener.checkNaturalId() line 80.
> i traced through that method, this is what happens:
> 1. in checkNaturalId, loaded == null , so getNaturalIdSnapshot() is called
> 2. this ends up generating some sql that selects the SubscriptionId and EditionId from the Subscription row.
> 3. the sql is generated in AbstractEntityPersister.getNaturalIdentifierSnapshot(), which calls hydrate for each returned column of the natural-id,
> 4. but hydrate only returns the id, instead of the actual entity
> 5. so this array of ids (instead of entities) ends up back in DefaultFlushEntityEventListener.checkNaturalId() as 'loaded', which gets compared to 'current'
> the trouble is that 'current' contains the entities, but 'loaded' only contains the ids of those entites, so the natural-id check fails, and i get the exception.
> this only happens when 'loaded' is null in checkNaturalId().
> the javadocs for hydrate say you have to call "resolve" afterwards... this isn't being done, so maybe thats the fix. if the natural-id is not just simple properties, then resolve should also be called.
> <class name="Subscription" table="Subscriptions" batch-size="10">
> <id name="id" column="Id" type="int"><generator class="native" /></id>
> <natural-id>
> <many-to-one name="subscriber" class="Subscriber" column="SubscriberId" />
> <many-to-one name="edition" class="Edition" column="EditionId" />
> </natural-id>
> ....
> </class>
> <class name="Subscriber" table="Subscriber">
> <id name="id" column="id" type="int"><generator class="native" /></id>
> <map name="subscriptions" inverse="true" cascade="all,delete-orphan" batch-size="10">
> <key column="SubscriberId" />
> <map-key-many-to-many column="EditionId" class="Edition" />
> <one-to-many class="Subscription" />
> </map>
> </class>
--
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, 6 months
[Hibernate-JIRA] Created: (HHH-2401) CLOB truncation on DB2 when using 2 or 3 byte chars (UTF8)
by Simon Jongsma (JIRA)
CLOB truncation on DB2 when using 2 or 3 byte chars (UTF8)
----------------------------------------------------------
Key: HHH-2401
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2401
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.0.ga
Environment: Hibernate 3.2.0 GA + JBoss 4.0.4.GA on Windows XP + DB2 UDB for ISeries V5R3 + IBM JT Open driver 4.9
Reporter: Simon Jongsma
Priority: Minor
Attachments: ClobTruncated.zip
A CLOB column is used in DB2 mapped to a String in Java with the Hibernate "Text" mapping.
The column in DB2 has a CCSID 1208 which means "UTF8" (= Unicode).
The CLOB truncation occurs when characters are used that are UTF8 coded in more than one byte.
In that the string is truncated when persisted in the database.
For example the string
"Granpré Molière†; 0123456789". This string has three diacritical marks in it.
The é and è are coded in two bytes in UTF8 and the † in three bytes.
This string will be stored as "Granpré Molière†; 012345".
So "6789" is not stored.
It appears as though Hibernate does not take into account that a character can be more than 1 byte in UTF8.
The number of missing char's at the end is exactly: string.getBytes("UTF-8").length minus string.length()
It is not a problem of DB2 or the JT Open driver:
Storing and retrieving (from a Java program) the same String directly via Jdbc into the DB2 table and retrieving it, works 100% fine.
So this clearly points to a problem somewhere in Hibernate.
--
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, 6 months