[Hibernate-JIRA] Created: (HBX-1034) Need a way to have a "native-if-not-assigned" IdentifierGenerator
by Paul Shemansky (JIRA)
Need a way to have a "native-if-not-assigned" IdentifierGenerator
-----------------------------------------------------------------
Key: HBX-1034
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1034
Project: Hibernate Tools
Issue Type: New Feature
Reporter: Paul Shemansky
Attachments: hibernate-native-or-assigned-patch.diff
NOTE: I believe I have explored every documented possibility in achieving the desired functionality. If I have misused Hibernate, the forum, or Google, I humbly apologize and stand to be corrected.
With that being said, I believe this may be desired:
--------------------------------------------------------------------
By setting the Hibernate configuration's primary key column to use a "native" implementation, Hibernate ALWAYS generates the entity's id when a save() is being called. There is no way to "override" the generated id.
The attached patch creates an IdentityGenerator which allows a programmer to override the "generated" id, with an "assigned" id at runtime simply by setting the primary key property.
The patch also changes the IdentifierGeneratorFactory to allow the short-name selection of the generator via a configuration file.
Furthermore, the English documentation is patched to describe the generator, accordingly.
Possibly related issues and reference material:
The documentation does not seem to provide a solution for a native-if-not-assigned generator; you seem to only have one, or the other:
http://www.hibernate.org/hib_docs/reference/en/html/mapping.html#mapping-...
A scenario which describes a typical use case that warrants the proposed new feature:
http://forum.hibernate.org/viewtopic.php?t=982560&highlight=native+id+gen...
--
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, 5 months
[Hibernate-JIRA] Created: (EJB-313) delete twice triggers detached entity error, but change to composite primary key and the exception is gone.
by Simon Ng (JIRA)
delete twice triggers detached entity error, but change to composite primary key and the exception is gone.
-----------------------------------------------------------------------------------------------------------
Key: EJB-313
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-313
Project: Hibernate Entity Manager
Issue Type: Bug
Affects Versions: 3.2.0.cr3
Environment: Windows XP Professional + Postgres 8.1 + Spring 2 + JPA + Hibernate 3.2.3
Reporter: Simon Ng
Attachments: DeleteTwice.zip
The attached file DeleteTwice.zip has the entire project; and the primary key is a composite primary key. Run the unit test and there is no exception, just an INFO level message of "handling transient entity in delete processing".
Next, delete RestaurantPK.java, and change Restaurant.java to use a simple primary key:
package blog.jpa.domain;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToOne;
@Entity
public class Restaurant {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
private String name;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Change the onSetUpInTransaction to use different SQL statement to reflect a different table
protected void onSetUpInTransaction() throws Exception {
jdbcTemplate.execute("insert into restaurant (id, name) values (1, 'Burger Barn')");
jdbcTemplate.execute("insert into restaurant (id, name) values (2, 'Veggie Village')");
jdbcTemplate.execute("insert into restaurant (id, name) values (3, 'Dover Diner')");
}
drop the table restaurant and run the unit test again. Now there is an exception
[junit] Testcase: testDeleteRestaurant(blog.jpa.dao.JpaRestaurantDaoTests): Caused an ERROR
[junit] Removing a detached instance blog.jpa.domain.Restaurant#3; nested exception is java.lang.IllegalArgumentExce
ption: Removing a detached instance blog.jpa.domain.Restaurant#3
[junit] org.springframework.dao.InvalidDataAccessApiUsageException: Removing a detached instance blog.jpa.domain.Res
taurant#3; nested exception is java.lang.IllegalArgumentException: Removing a detached instance blog.jpa.domain.Restaura
nt#3
[junit] Caused by: java.lang.IllegalArgumentException: Removing a detached instance blog.jpa.domain.Restaurant#3
[junit] at org.hibernate.ejb.event.EJB3DeleteEventListener.performDetachedEntityDeletionCheck(EJB3DeleteEventLis
tener.java:45)
The java.lang.IllegalArgumentException is specified in the JPA spec.
--
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, 5 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, 5 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, 5 months
[Hibernate-JIRA] Créée: (HHH-2086) Patch for bug HHH-2076 and to be able to use <formula> in <key> for <one-to-many>
by Xavier Brénuchon (JIRA)
Patch for bug HHH-2076 and to be able to use <formula> in <key> for <one-to-many>
---------------------------------------------------------------------------------
Key: HHH-2086
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2086
Project: Hibernate3
Type: Patch
Components: core
Versions: 3.2.0.cr4
Reporter: Xavier Brénuchon
Attachments: formula_one_to_many.patch
Hello,
There is a patch to correct bug HHH-2076 and make an improvement for HHH-944.
In fact, theses 2 cases are linked. They need, amongst other things, a formula in the right part of outer join.
This patch is simple but many class concerns (to propagate formula templates).
About formula in one-to-many :
You must have at least a column (not only formula), because it's not possible to have an Update order without at least a column. If it is the case, hibernate patch will raise an MappingException rightly.
This patch add two TestCase :
org.hibernate.test.onetoone.bidirectionnalformula. OneToOneBidirectionalFormulaTest
org.hibernate.test.onetomany.formula. OneToManyFormulaTest
Would it be possible to integrate this patch into Hibernate 3.2 ?
--
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