[Hibernate-JIRA] Created: (HHH-3510) Sybase - Timestamp not being translated to the built-in database function
by Juraci Paixao Krohling (JIRA)
Sybase - Timestamp not being translated to the built-in database function
-------------------------------------------------------------------------
Key: HHH-3510
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3510
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.2.4.sp1
Environment: Branch_3_2_4_SP1_CP and Sybase 15
Reporter: Juraci Paixao Krohling
Test Case: ComponentTest#testComponentQueries
Hibernate query "from Employee e where e.person = ('steve', current_timestamp)" should have translated "current_timestamp" to "getdate()" [1]:
14:49:11,087 DEBUG SQL:424 - select employee0_.ID as ID1_, employee0_.HIRE_DATE as HIRE2_1_, employee0_.name as name1_, employee0_.dob as dob1_, employee0_.value1 as value5_1_, employee0_.value2 as value6_1_ from T_EMP employee0_ where employee0_.name='steve' and employee0_.dob=current_timestamp
14:49:11,535 WARN JDBCExceptionReporter:77 - SQL Error: 207, SQLState: ZZZZZ
14:49:11,536 ERROR JDBCExceptionReporter:78 - Invalid column name 'current_timestamp'.
[1] SybaseDialect, line 58: registerFunction( "current_timestamp", new NoArgSQLFunction("getdate", Hibernate.TIMESTAMP) );
--
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
14 years, 3 months
[Hibernate-JIRA] Created: (HHH-3018) Configuration element to tell Hibernate to have just one insert to flush an entity and not both an insert and an update.
by Nicolas Cazottes (JIRA)
Configuration element to tell Hibernate to have just one insert to flush an entity and not both an insert and an update.
------------------------------------------------------------------------------------------------------------------------
Key: HHH-3018
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3018
Project: Hibernate3
Issue Type: Improvement
Components: core
Affects Versions: 3.2.5
Reporter: Nicolas Cazottes
Attachments: testXMLTypeUpdates.zip
While analyzing the SQL queries Hibernate generates to persist objects, I fall on a behaviour, that I first found strange, which is that in one flush of one transaction, there may be both an insert and an update for a given entity. My first expectation was to have only one insert and no update.
After a few search, I discover that conversation (http://forum.hibernate.org/viewtopic.php?p=2191664&sid=c571096bda4a6b636e...) that explains it is normal in the case of a save with modifications after save.
I discover (cf the classes of my zip showing it) that this behaviour is also present in the case of a relation that is managed by cascade. What I noticed is that the insert of the related entity is planned when the first hql query is executed after the relation has been established. So if the related entity is modified after the query execution (for exemple depending on the result of the query), an update will be executed.
This behaviour is understandable but in my case, the update is really expensive (because it acts on an XMLType column) and unless I set a FlushMode to COMMIT (which I found really not a good solution), I can not control that Hibernate will generate both an insert and an update or only an insert. I know I could also set the relation just before the commit in order to avoid insert+update but this solution is not possible in my case and I find it not elegant (it would break the semantic of the cascade of the relation).
I suggest to introduce a new configuration element (similar to the flushmode) in Hibernate in order to be able to have control whether Hibernate generates an insert containing the data of the entity at the first save or an insert containing the data of the entity at the flushing time.
Note : The attached files (which is the smallest extraction of what does my application) shows that behaviour both for the save call and the cascade declenched by a query.
Note2 : I found an issue in jira number 2621 submited by someone else that is related to this subject in think.
--
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
14 years, 3 months
[Hibernate-JIRA] Created: (HHH-2426) Misleading logging messages when using ThreadLocalSessionContext
by Don Smith (JIRA)
Misleading logging messages when using ThreadLocalSessionContext
----------------------------------------------------------------
Key: HHH-2426
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2426
Project: Hibernate3
Type: Improvement
Components: core
Versions: 3.2.0.ga
Reporter: Don Smith
Priority: Minor
The log messages printed out by TransactionFactoryFactory and SettingsFactory are misleading when using ThreadLocalSessionContext:
2007-02-09 21:49:58,581 INFO [org.hibernate.transaction.TransactionFactoryFactory:info] Using default transaction strategy (direct JDBC transactions)
2007-02-09 21:49:58,588 INFO [org.hibernate.transaction.TransactionManagerLookupFactory:info] No TransactionManagerLookup Configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
2007-02-09 21:49:58,590 INFO [org.hibernate.cfg.SettingsFactory:info] Automatic flush during beforeCompletion(): disabled
2007-02-09 21:49:58,591 INFO [org.hibernate.cfg.SettingsFactory:info] Automatic session close at end of transaction: disabled
This does not indicate that sessions will be closed after commit, which is the behavior when using ThreadLocalSessionContext.
--
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
14 years, 3 months
[Hibernate-JIRA] Created: (ANN-682) @ForeignKey override of @MappedSuperclass
by Christian Bauer (JIRA)
@ForeignKey override of @MappedSuperclass
-----------------------------------------
Key: ANN-682
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-682
Project: Hibernate Annotations
Issue Type: New Feature
Components: binder
Reporter: Christian Bauer
Put this @ManyToOne in a @MappedSuperclass:
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "CREATED_BY_USER_ID", nullable = false)
// Ideally this foreign key should be ON DELETE SET NULL, however...
// Hibernate can't rename these so subclasses would get the same FK constraint name. This doesn't
// work, so we need to let Hibernate create a random identifier for these. We could fix this in the
// DatabaseObjects.hbm.xml file but we can't even address it because the name is random. This sucks.
// So we do a manual SET NULL|DEFAULT when userHome.remove() is called.
// @org.hibernate.annotations.ForeignKey(name = "FK_WIKI_NODE_CREATED_BY_USER_ID")
protected User createdBy;
Now all subclasses get that foreign key constraint name in the database catalog, which isn't possible - constraint names have to be unique.
--
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
14 years, 3 months
[Hibernate-JIRA] Created: (HSEARCH-527) Hibernate Search Not giving any errror when @DocumentId not mentioned, but hangs at configuration.buildSessionFactory()
by Kiran Narasareddy (JIRA)
Hibernate Search Not giving any errror when @DocumentId not mentioned, but hangs at configuration.buildSessionFactory()
-----------------------------------------------------------------------------------------------------------------------
Key: HSEARCH-527
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-527
Project: Hibernate Search
Issue Type: Bug
Components: engine
Affects Versions: 3.1.0.GA
Environment: Hibernate core : 3.3.1 GA, Hibernate Annotations : 3.4.0.GA, Hibernate commons Annotations : 3.1.0 GA, Lucene core 2.4.1
Mysql Community 5.0.41
Reporter: Kiran Narasareddy
Priority: Minor
Consider a case in which primary key is associated with only Base class, with no primary key in any other subclasses marked for Lucene's document id.
Now, if this attribute is not annotated with @DocumentId, hibernate engine shows no errors, but it hangs up at configuration.buildSessionFactory(); and doesn't move forward.
The moment the annotation is added, the SessionFactory gets built and the application works.
Example Model :
Aobject.java :
long id; (this is the intended field to be taken as documentID for lucene )
MyObject extends Aobject
(This class is to be indexed.It has no id field of its own, the same id from AObject acts as PK for MyObject Also)
--
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
14 years, 3 months
[Hibernate-JIRA] Created: (HHH-3339) Query cache stops working after object save
by Alex Oleynikov (JIRA)
Query cache stops working after object save
-------------------------------------------
Key: HHH-3339
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3339
Project: Hibernate3
Issue Type: Bug
Components: caching (L2)
Affects Versions: 3.2.6
Environment: Hibernate 3.2.6, MS SQL 2005 Database. Windows XP SP2
Reporter: Alex Oleynikov
It seems like HB Query cache stops working as soon as given object type is being saved (it does not matter if it was save to existing object or insert of new object instance).
The code looks like this. Where User is just a primitive POJO with couple of properties.
// #1
query = session.createQuery("from User where userID = :id");
query.setCacheable(true);
query.setParameter("id", 10);
user = (User) query.list().get(0);
// #2
query = session.createQuery("from User where userID = :id");
query.setCacheable(true);
query.setParameter("id", 10);
user = (User) query.list().get(0);
// insert new User object
user = new User();
user.setUserID((int)(Math.random() * Integer.MAX_VALUE));
user.setUserName("Ten");
session.beginTransaction();
session.save(user);
session.getTransaction().commit();
// #3
query = session.createQuery("from User where userID = :id");
query.setCacheable(true);
query.setParameter("id", 10);
user = (User) query.list().get(0);
// #4
query = session.createQuery("from User where userID = :id");
query.setCacheable(true);
query.setParameter("id", 10);
user = (User) query.list().get(0);
>From MS SQL Profiler I can clearly see that no queries is executed for #2 (e.g. it hit the cache), but queries are executed for #3 and #4. From HB debug log I see following:
For #2 Query (cache is hit) - correct:
06:54:25,337 DEBUG StandardQueryCache:102 - checking cached query results in region: org.hibernate.cache.StandardQueryCache
06:54:25,337 DEBUG StandardQueryCache:156 - Checking query spaces for up-to-dateness: [USERS]
06:54:25,337 DEBUG StandardQueryCache:117 - returning cached query results
During User insert:
06:54:25,368 DEBUG UpdateTimestampsCache:65 - Invalidating space [USERS], timestamp: 4967466866147328
For #3 Query:
06:54:25,368 DEBUG StandardQueryCache:156 - Checking query spaces for up-to-dateness: [USERS]
06:54:25,368 DEBUG UpdateTimestampsCache:86 - [USERS] last update timestamp: 4967466866147328, result set timestamp: 4967466865061888
06:54:25,368 DEBUG StandardQueryCache:113 - cached query results were not up to date
For #4 Query (or any subsequent query for this matter):
06:54:25,368 DEBUG StandardQueryCache:156 - Checking query spaces for up-to-dateness: [USERS]
06:54:25,368 DEBUG UpdateTimestampsCache:86 - [USERS] last update timestamp: 4967466866147328, result set timestamp: 4967466865061888
06:54:25,368 DEBUG StandardQueryCache:113 - cached query results were not up to date
Please note the timestamp numbers for #4 query - even though I would expect query to be re-cached in #3, it still shows old timestamp. So I may think that when re-caching a query it does not update cache entry timestamp which is not up-to-date due to save().
--
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
14 years, 3 months