Dialect support for SQL comments.
by Daniel Bell
Hi,
I have recently tried turning on SQL comments in hibernate 3.2.6.ga.
However, I found that our database (informix 7.31) did not support SQL
where the comment was at the start of the comment. Instead, the comment
needed to be after the SQL. For example:
/* not accepted by informix 7.31*/ select * from systables;
select * from systables /* accepted by informix 7.31*/
Because of this, I have added a method to the Dialect for adding comments:
/**
* Add a comment to the SQL string.
*
* @param sql StringBuffer holding the SQL.
* @param comment Comment to add to the SQL. May be null.
*/
public void addCommentToSql(StringBuffer sql, String comment) {
if (StringHelper.isNotEmpty(comment))
sql.insert(0, "/* " + comment + " */ ");
}
Thus, the default implementation provides the same functionality as
before. However, derived Dialects may override this method to add the
comment in a different location.
It is also possible to add additional comments in the derived Dialect.
In our case, we also add the Java thread ID.
I have included a complete patch for this change for hibernate 3.2.6.GA.
Please consider its inclusion in Hibernate.
Thanks,
Daniel.
15 years, 6 months
RE: Hibernate Search Road Map
by John Griffin
HSEARCH-170 - @Boost
I talked over this and 269 with Sanne and for this one I'll specify
add @Boost to the field level and also allow boost=x.xF in @Field. If both
are specified on the same field, and I think the odds of this happening are
slim to none) I can either throw an exception or one has precedence over the
other. In the latter case I think @Boost should have precedence. Thoughts?
HSEARCH-269 - Dictionary
Rather than refactor DirectoryProvider to support a dictionary index
in the baseDir, I came up with the idea of a DictionaryProvider, Sanne and I
agreed the best way to do this is that the DictionaryProvider extend
DirectoryProvider and we go from there. This provides the best flexibility.
John G.
-----Original Message-----
From: hibernate-dev-bounces(a)lists.jboss.org
[mailto:hibernate-dev-bounces@lists.jboss.org] On Behalf Of
hibernate-dev-request(a)lists.jboss.org
Sent: Saturday, October 11, 2008 10:00 AM
To: hibernate-dev(a)lists.jboss.org
Subject: hibernate-dev Digest, Vol 28, Issue 5
Send hibernate-dev mailing list submissions to
hibernate-dev(a)lists.jboss.org
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.jboss.org/mailman/listinfo/hibernate-dev
or, via email, send a message with subject or body 'help' to
hibernate-dev-request(a)lists.jboss.org
You can reach the person managing the list at
hibernate-dev-owner(a)lists.jboss.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of hibernate-dev digest..."
Today's Topics:
1. Re: JPA's allocationSize & SequenceHiLoGenerator (Alexander Snaps)
2. Hibernate Search 3.1 road map (Emmanuel Bernard)
----------------------------------------------------------------------
Message: 1
Date: Fri, 10 Oct 2008 18:17:08 +0200
From: "Alexander Snaps" <alex.snaps(a)gmail.com>
Subject: Re: [hibernate-dev] JPA's allocationSize &
SequenceHiLoGenerator
To: " Gabriele Salg? " <gsalgo(a)noemalife.com>
Cc: hibernate-dev(a)lists.jboss.org
Message-ID:
<31c5c4ca0810100917y1358209er74a096a29df6bf15(a)mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Here's the answer I got:
http://in.relation.to/Bloggers/New323HibernateIdentifierGenerators
As for the allocationSize's default, it is 1 using Hibernate. It won't use
the HiLo algorithm by default.
Everything is covered at the url above... except why isn't this the default
behavior (at least for the JPA impl.)
Alex
On Fri, Oct 10, 2008 at 3:45 PM, Gabriele Salgr <removed(a)example.com>wrote:
> Hi,
> I read the your post on Hibernate forum:
> http://lists.jboss.org/pipermail/hibernate-dev/2007-November/002811.html
>
> I was just wondering about the same things you wrote. Have you got any
> answer?
> Moreover, do you know if setting the 'allocationSize' attribute to 1
> instead of the default value (50) can give any kind of problem or
undesired
> side effect?
>
> Thanks
> Gabriele Salgr
>
>
--
Alexander Snaps <alex.snaps(a)gmail.com>
http://www.jroller.com/page/greenhorn
http://www.linkedin.com/in/alexandersnaps
16 years
Constraint naming in HBM2DDL schema export
by "Jürgen Avian"
Hi,
some time ago I added the following feature to the Hibernate Core:
Automated naming of the constraint types in the hbm2ddl schema export (naming scheme in brackets)
- Primary Key Constraints (PK_<TABLENAME><IDX>)
- Unique Constraints (UK_<TABLENAME><IDX>_<COLUMNNAME><IDX>)
- Check Constraints (<CT>_<TABLENAME><IDX>_<COLUMNNAME><IDX>)
- Foreign Key Constraints (FK_<TABLENAME><IDX>_<COLUMNNAME><IDX>)
<CT> for unique constraints is one of:
- NN for Not Null Constraints
- CK for other Check Constraints
<IDX> is an index that is needed if the table or
column name has to be shortened because of a maximal
length of the constraint name in the database.
At the moment, I have implemented it in the following way:
- The constraint names are generated in the dialect.
- Constraint naming can be turned on and off in the
config file (persistence.xml).
- Via the config file you can specify a character
that is removed from the table and column names to
improve the constraint name length utilization,
e.g. COMPANY_DETAILS can be reduced to COMPANYDETAILS
- The maximal constraint name length can be specified
in the config file as well.
That way, it is possible to identify the reason for a constraint violation much more easier. Additionally, you have not to be at the mercy of the database constraint naming schema.
Is something similar implemented at the moment by anyone?
I would be pleased if you like to add this functionality to the hibernate sources.
In this case I would adapt my implementation:
- Create an own class e.g. DefaultConstraintNamingStrategy,
according to the table and column NamingStrategy ...
- ... that can be overwritten and plugged in via the
config file.
What do you think about this idea?
Best regards,
Jürgen
--
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
16 years
Hibernate Disjunction Criteria broken: returns true for empty list of criteria
by William Pugh
When you form a Hibernate Disjunction criteria, but don't add any
clauses to it, you get a criteria that matches everything.
Generally, when you perform a reduction over an empty list, the
expected result is the identity element for the reduction. For
example, the sum of the empty list is 0, the product of the empty list
is 1, the conjunction of the empty list is true, and the disjunction
of the empty list is false.
Hibernate uses "1=1" as the SQL for both Conjunction and Disjunction
criteria if there is an empty list of criteria.
Seems to me that this is a bug, although Disjunction isn't documented,
so who knows what it is "supposed" to do.
Bill Pugh
16 years
Envers in Hibernate
by Adam Warski
Hello,
currently I'm a working for the jboss.org team, but as you maybe
remember I also created the Envers project (http://www.jboss.org/
envers/). I would like to change my scope of work a bit and work
"officialy" on Envers. But, as the logical place to do this would be
in hibernate, this brings the question: would you (= the Hibernate
team) be interested in Envers and in me developing it further? :)
The three main areas in which I would like to develop in Envers are:
- completing support for JPA mappings: joined and table-per-class
inheritance (the rest works already, as far as I know)
- adding support for hibernate-annotations specific mappings - for
example collections of components, relations in components
- integration with Hibernate Search - to enable indexing and searching
of history of an entity
- support for different versioning schemes - like storing only the
fields that changed, instead of the whole entity
- and of course anything else that you suggest :)
--
Adam
16 years
Hibernate Search: making changes to different indexes concurrently
by Sanne Grinovero
After the latest changes all locks between different DirectoryProviders
are gone and "sequentiality" is no longer needed, I would like to
have the changes made on different DP happen concurrently,
this is needed for several other optimizations.
the workQueue gets split by DP (code exists already), and then:
in case of "sync" indexing:
schedule each sub-queue to the executor as separate tasks,
and wait for them all.
in case of "async" indexing:
just schedule each sub-queue, no need to wait.
This is quite easy to implement -inside- the luceneBackend, but there I have no
reference to the original ThreadPool I should use for this task.
If I could move this code to the BatchedQueueingProcessor I would see several
benefits:
1) the optimization is "free" for other existing backends.
2) You could create a different Runnable for each
DirectoryProvider-specific-queue.
However if I do this the naive way I would break the current
BackendQueueProcessorFactory API,
which I know for sure many customers implement by reading around the forum.
The most elegant solution is IMHO: instantiate a different
BackendQueueProcessorFactory
for each DP; this way the API's don't change, you get full
concurrency without having
to worry about support by the backends, and it would be very easy to
have different
implementations for each DP's backend, configured independently as
"sync" or "async":
you could use jms for some indexes and lucene for others, or other
implementations
instantiated with different parameters (think about different JMS topics).
The code is pretty simple, can be done changing in a first step only
the BatchedQueueingProcessor
to solve for example
" New Feature - HSEARCH-268 - Run optimize() (all classes) in parallel"
and then with two more patches to remove unneeded code from the
current lucene backend,
and finally to enable indipendend backends configuration (just adapt
the cfg reading
and document it all).
Having the BatchedQueueingProcessor "have a look" in the queue has
other benefits,
it would be the right place to implement
" Bug - HSEARCH-257 - Ignore delete operation when Core does update
then delete on the same entity"
as a map is being built for each "todo" (I'm going to need it anyway
to classify work per-DP).
I would be happy to implement the first step soon ( before tomorrow),
that is creating N-BackendQueueProcessorFactorys
instead of one, to submit the works to concurrent queues.
comments?
kind regards,
Sanne
16 years, 1 month
Code Review: ANN-778
by Juraci Costa
Guys,
This is the one which originated the changes in the parent Test class for Entity Manager, but somehow we managed to forget it :-) So, after discussing the approaches, I did a new diff to replace the old one, which uses the parent's capabilities on handling the sessions and exceptions.
Nothing exciting in this diff, maybe the only noticeable thing here is that I removed the teardown method and moved the "session.close();" method call to the tests, because the runTest checks for unclosed sessions (and it runs before the teardown).
So, please take a look and let me know if you spot something wrong.
- Juca.
16 years, 1 month
Recursive exception and StackOverflowError in JTATransactionFactory.getUserTransaction()
by Ovidiu Feodorov
Hello there,
Is there a JIRA issue for the recursive error in
JTATransactionFactory.getUserTransaction() in 3.3.1.GA or you want me to
add one + patch?
If the UserTransaction name is invalid, NamingException is thrown
recursively by getUserTransaction() call (line 172) until the stack is
full.
You probably wanted to call getUserTransactionName() instead of
getUserTransaction().
Cheers
Ovidiu
16 years, 1 month