Nice talk on Git/GitHub
by Gunnar Morling
Hi all,
just stumbled upon an awesome talk on "Git and GitHub secrets" [1].
The talk mentions a lot of not so well known features in Git(Hub).
Just some things I wasn't aware of so far:
* press "t" on a GitHub repo page for the file finder which allows to
quickly open files (press "?" for all commands)
* subscribe other people to pull requests/issues: put "@username" into a comment
* see what has happened since last 5 days on master:
https://github.com/hibernate/hibernate-orm/compare/master@{5.day.ago}...m...
* record and reuse conflict resolutions: git config --global
rerere.enabled 1 (haven't tried that yet, but it sounds interesting
e.g. for repeated rebases of long-living branches)
All in all a really worth watching.
--Gunnar
[1] http://vimeo.com/42530011
12 years, 6 months
index without database
by Tomasz Prus
Hi,
I have application with Spring and Hibernate, I'm using also Hibernate
Search annotations but I stacked with problem now because I need also to
index a few objects without storing them into a database, is it possible?
When I removed @Entity annotation from one class index isn't creating.
Best regards,
Tomasz Prus,
Springloops
12 years, 6 months
Quoted names
by Dmitry Geraskov
Hi, guys,
I am working on the hibernate tools code generation problem for tables
which has quoted names (name, schema or catalog has special symbols(dot
for ex.)).
Any reason why Table#setName(x) and Table#setSchema(x) have "unquote"
logic, but Table#setCatalog(x) does not?
Dmitry Geraskov
12 years, 6 months
Native SQL queries and unknown JDBC type mappings
by Steve Ebersole
Been seeing a lot of questions lately on StackOverflow about native SQL
queries and the "No Dialect mapping for JDBC type: XYZ" error.
Is there a reason we don't do a best effort to resolve these using the
drivers database metadata? In fact we already read and parse this
information during JdbcServices init
(org.hibernate.engine.jdbc.spi.ExtractedDatabaseMetaData#getTypeInfoSet).
We could resolve the unknown type to its
org.hibernate.engine.jdbc.internal.TypeInfo and use the TypeInfo's
reported javaType to resolve the Hibernate type to use.
WDYT?
Then the dialect really just needs to become involved in the exception
case(s). This is really another case of what I want to do eventually
where we blend information from the JDBC driver's DatabaseMetaData and
Dialect.
--
steve(a)hibernate.org
http://hibernate.org
12 years, 6 months
org.hibernate.cfg.annotations.CollectionBinder#buildOrderByClauseFromHql
by Steve Ebersole
All, I need some help interpreting the code in
org.hibernate.cfg.annotations.CollectionBinder#buildOrderByClauseFromHql
git annotate is showing me as the author though I know for sure I am
not, so I am not sure who to ask...
I am addressing the problem of order by fragments and joined subclasses.
There are 2 forms of buildOrderByClauseFromHql, one for collections of
entities and one for collections of components. I basically gutted the
one for collections of entities. I am not sure what to do with the one
for collections of components. I commented it out and all the tests
pass, but my guess is that there is simply not tests testing what that
code is supposed to be doing. And unfortunately the method has pretty
high complexity but no comments explaining what is going on.
Anyone able to help with what this method is supposed to do?
--
steve(a)hibernate.org
http://hibernate.org
12 years, 6 months
Question regarding method ReadWriteEhcacheNaturalIdRegionAccessStrategy#afterInsert
by Demetz, Guenther
Hi Alex,
I have a question in regard to class ReadWriteEhcacheNaturalIdRegionAccessStrategy where you are listed as co-author.
Do you maybe know, why inserts do only succeed if there is no existing value mapped to the actual key?
Code-snippet of ReadWriteEhcacheNaturalIdRegionAccessStrategy#afterInsert
<< if ( item == null ) {
<< region.put( key, new Item( value, null, region.nextTimestamp() ) );
Namely I did expect, that in case of item being an "unlocked" Lock, the insert should succeed nonetheless.
Something like following:
>> if ( item == null || item.isWriteable( region.nextTimestamp(), null, null ) ) {
>> region.put( key, new Item( value, null, region.nextTimestamp() ) );
I ask because after trying to resolve a Todo in StatefulPersistenceContext (you find it by searching for "should be using access strategy, not plain evict.. "),
some test in CachedMutableNaturalIdStrictReadWriteTest fails exactly because such "re-caching" attempts do not succeed anymore.
best regards
Guenther Demetz
12 years, 6 months
SQLServer getLimitString() refactoring
by Łukasz Antoniak
Hello all,
Release 4.1.4 contained few fixes to SQLServer2005Dialect#getLimitString(String, boolean) method. The main JIRA issue (which has
links to other related tickets) is HHH-7019.
Quincy Leung added recently a comment about moving formula expressions to GROUP BY which causes query to fail. In case of SELECT
DISTINCT usage in the original query, Hibernate moves all expressions from SELECT clause to GROUP BY, because otherwise adding
ROW_NUMBER() function produces larger result set (an extra, unique column is added to DISTINCT expression; ticket HHH-5715).
Quincy Leung suggested to omit formula expressions in GROUP BY clause, but I am not sure whether in every case GROUP BY applied to
the subset of selected columns would work similarly to original DISTINCT.
I have taken a step back and tried to modify original SQL query as little as possible to enable paging.
Assumed original query:
SELECT DISTINCT tab1.col1 col1
, tab1.col2 col2
, ( SELECT tab2.col3
FROM tmp_tab2 tab2
WHERE tab2.col1 = tab1.col1
) col3
FROM tmp_tab1 tab1
WHERE tab1.col1 >= 1
ORDER BY tab1.col1;
Applying limit expression:
WITH query AS (
SELECT inner_query.*
, ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) as __hibernate_row_nr__
FROM ( SELECT DISTINCT TOP ${offset + last} tab1.col1 col1
, tab1.col2 col2
, ( SELECT tab2.col3
FROM tmp_tab2 tab2
WHERE tab2.col1 = tab1.col1
) col3
FROM tmp_tab1 tab1
WHERE tab1.col1 >= 1
ORDER BY tab1.col1
) inner_query
)
SELECT * FROM query WHERE __hibernate_row_nr__ >= ${offset} AND __hibernate_row_nr__ < ${offset + last};
I have enclosed original query with "SELECT * FROM (...) inner_query" expression and put "ROW_NUMBER() OVER (ORDER BY
CURRENT_TIMESTAMP) as __hibernate_row_nr__" outside. This forced me only to add TOP expression when original query contains ORDER
BY clause to prevent error: "The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common
table expressions, unless TOP or FOR XML is also specified.". Moreover, TOP might add performance hit, because it selects only
first N rows from the original query.
I strongly believe that this refactoring would resolve SQLServer's limit string errors but wanted to consult this modification
with the community.
Feel free to comment and post cases where proposed solution fails.
Regards,
Lukasz Antoniak
12 years, 6 months
Problems with Hibernate 4.1.3
by Jochen Schreiber
Hello,
i have some problems with Hibernate 4.1.3. Before Hibernate 4.1.3 i used Hibernate 3.
1. I don't found the "ResultSet"-Object as in Hibernate 3 so i want to get my data from the query as follows:
SQLQuery q = MainWindow.getSession().createSQLQuery(query).addEntity("ins", ALL_RSC_DATA.class);
ScrollableResults sr = q.scroll();
while (sr.next()) {
ALL_RSC_DATA data = (ALL_RSC_DATA) sr.get()[0];
}
The processing step need to long time. The old version works faster. Where is my fault? Is this not the way to get large data sets and process them?
2. In the old "ResultSet"-Objects i could get the metadata for detecting the column names. Where is this object now or is there a another way to get the column names from an sql query? This query is dynamic so i need to detect which columns are in the query.
With best
bladepit
12 years, 6 months
master->metamodel and matrix/test consolidation
by Steve Ebersole
I am done with consolidating src/matrix into src/test and merging master
into metamodel. Everything seems to be working. Let me know if you see
any issues.
I did need to adjust the "matrix plugin" a little bit. We should talk
about testing as it relates to the database matric a little more and
specifically how we want this to work. We have been using the the
"dynamic task" approach for quite some time now. Curious how everyone
likes/dislikes it now after using it in anger for the last months.
The one main thing that changed in the plugin is that there is no longer
a notion of a "matrix unit test". `gradle test` simply runs all the
tests using the default database (h2) for any tests that need a
database. Then there are the "matrix test tasks" that perform the test
using the requested database. I did not alter those task names.
However, running one of those "matrix test tasks" no longer runs the
[test] task (default database) as a task dependency.
--
steve(a)hibernate.org
http://hibernate.org
12 years, 6 months