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
Hibernate EntityManager reusing MC facilities
by Emmanuel Bernard
I have been chatting with Ales and here is the contract that HEM could
rely on to scan entities and DD files.
Context:
An EntityManagerFactory (EMF) is bootstrapped by the container by
passing a PersistenceUnitInfo class
http://anonsvn.jboss.org/repos/hibernate/jpa-api/trunk/src/main/java/java...
Which gives:
- the root URL of the PU
- the mapping files
- the URLs of the jars to scan
The container will also pass the MC discovery contract implementation
in the contextual Map.
If this impl is available in the Map, HEM will go use the MC
facilities, if not, it will rely on it's own legacy infrastructure.
Here is a proposal for the contract
/**
* return all packages in the jar matching one of these annotations
* if annotationsToLookFor is empty, return all packages
*/
Set<Package> getPackagesInJar(URL jartoScan, List<Annotation>
annotationsToLookFor);
/**
* return all classes in the jar matching one of these annotations
* if annotationsToLookFor is empty, return all classes
*/
Set<Class<?>> getClassesInJar(URL jartoScan, List<Annotation>
annotationsToLookFor);
/**
* return all files in the jar matching one of these file names
* if filePatterns is empty, return all files
* eg **/*.hbm.xml, META-INF/orm.xml
*/
Set<[structure containing file name + InputStream]> getFilesInJar(URL
jartoScan, List<String> filePatterns);
Optional contract but would be nice to have:
/**
* return all files in the classpath (ie PU visibility) matching one
of these file names
* if filePatterns is empty, return all files
* the use case is really exact file name.
*/
Set<[structure containing file name + InputStream]>
getFilesInClasspath(URL jartoScan, List<String> filePatterns);
/** return the unqualified JAR name ie customer-model.jar or store.war
*/
String getUnqualifiedJarName(URL);
15 years, 7 months
Is there any specific reason for not removing any successful action from the action list in ActionQueue executeActions
by Pavitar Singh
Hi
Is there any specific reason for not removing any successful action from the
action list.
In Method of class org.hibernate.engine.ActionQueue
private void executeActions(List list) throws HibernateException {
int size = list.size();
for ( int i = 0; i < size; i++ ) {
execute( (Executable) list.get(i) );
}
list.clear();
session.getBatcher().executeBatch();
}
Why is list being cleared in one go rather then removing after every action.
something like this
private void executeActions(List list) throws HibernateException {
for(Iterator actionIter = list.iterator();actionIter.hasNext();){
execute( (Executable) actionIter .next());
actionIter.remove();
}
session.getBatcher().executeBatch();
}
Reasons i am facing issues due to this is following:
For Example in ActionQueue i have three EntityUpdateAction and my Entity is
versioned
and my 3rd EntityUpdateAction Fails and say i can recover from this failure
programmatically and i try to flush again. This time even my first Action
will fail as it would have already updated Version No.
And even theoretically why will i want to retry a Successful Action.
I think after action is successfully executed it should be removed from the
list.
Regards
Pavitar
--
Pavitar Singh
Blog: http://blog.webscale.co.in
15 years, 7 months
Re: [hibernate-dev] Hibernate EntityManager reusing MC facilities
by Emmanuel Bernard
The URL does change from one call to another so the constructor taking
a URL won't work here.
Set instead of List, yes that makes sense.
/**
* return all packages in the jar matching one of these annotations
* if annotationsToLookFor is empty, return all packages
*/
Set<Package> getPackagesInJar(URL jartoScan, Set<Annotation>
annotationsToLookFor);
/**
* return all classes in the jar matching one of these annotations
* if annotationsToLookFor is empty, return all classes
*/
Set<Class<?>> getClassesInJar(URL jartoScan, Set<Annotation>
annotationsToLookFor);
/**
* return all files in the jar matching one of these file names
* if filePatterns is empty, return all files
* eg **/*.hbm.xml, META-INF/orm.xml
*/
Set<[structure containing file name + InputStream]> getFilesInJar(URL
jartoScan, Set<String> filePatterns);
Optional contract but would be nice to have:
/**
* return all files in the classpath (ie PU visibility) matching one of
these file names
* if filePatterns is empty, return all files
* the use case is really exact file name.
*/
Set<[structure containing file name + InputStream]>
getFilesInClasspath(URL jartoScan, Set<String> filePatterns);
/** return the unqualified JAR name ie customer-model.jar or store.war
*/
String getUnqualifiedJarName(URL);
On Mar 27, 2009, at 18:12, Elias Ross wrote:
> Probably would make more sense to pass in a Set<T> or Collection<T> as
> the method arguments, as Set<X> is being returned.
>
> And since many of the methods take a URL, maybe make it more OOP
> style, like something like:
>
> class JarScanner {
> public JarScanner(URL url);
> public Set<Entry> getFiles(Collection<String> filePatterns);
> }
>
> On Fri, Mar 27, 2009 at 2:49 PM, Emmanuel Bernard
> <emmanuel(a)hibernate.org> wrote:
>> I have been chatting with Ales and here is the contract that HEM
>> could rely
>> on to scan entities and DD files.
>>
>> Here is a proposal for the contract
>>
>> /**
>> * return all packages in the jar matching one of these annotations
>> * if annotationsToLookFor is empty, return all packages
>> */
>> Set<Package> getPackagesInJar(URL jartoScan, List<Annotation>
>> annotationsToLookFor);
>>
>> /**
>> * return all classes in the jar matching one of these annotations
>> * if annotationsToLookFor is empty, return all classes
>> */
>> Set<Class<?>> getClassesInJar(URL jartoScan, List<Annotation>
>> annotationsToLookFor);
>>
>> /**
>> * return all files in the jar matching one of these file names
>> * if filePatterns is empty, return all files
>> * eg **/*.hbm.xml, META-INF/orm.xml
>> */
>> Set<[structure containing file name + InputStream]> getFilesInJar(URL
>> jartoScan, List<String> filePatterns);
>>
>> Optional contract but would be nice to have:
>>
>> /**
>> * return all files in the classpath (ie PU visibility) matching
>> one of
>> these file names
>> * if filePatterns is empty, return all files
>> * the use case is really exact file name.
>> */
>> Set<[structure containing file name + InputStream]>
>> getFilesInClasspath(URL
>> jartoScan, List<String> filePatterns);
>>
>> /** return the unqualified JAR name ie customer-model.jar or
>> store.war */
>> String getUnqualifiedJarName(URL);
>>
>>
>>
>> _______________________________________________
>> hibernate-dev mailing list
>> hibernate-dev(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>
>> --
>> This message has been scanned for viruses and
>> dangerous content by MailScanner, and is
>> believed to be clean.
>>
15 years, 8 months
Backward compatibilty latest snapshot
by Marcel Overdijk
Hi,
I tried to play with the latest 3.5.0-SNAPSHOT within my Grails 1.1 project
to integrate Hibernate Search.
Grails 1.1 is bases on Hibernate 3.3.1.
The problem I'm facing now is that 3.5.0-snapshot does not seem to be
backward compatible with 3.3.1
org.hibernate.dialect.DialectFactory was moved to org.hibernate.dialect.*
resolver*.DialectFactory (part of
http://fisheye.jboss.com/changelog/Hibernate?cs=15343).
Grails is using this factory class internally.
Sure thing is I can check out Grails source code change the package and
build Grails.
I'm just wondering now if the above change is just bad luck, or that I will
face a lot of other refactorings?
Cheers,
Marcel
15 years, 8 months
problem with pdf generated by maven-jdocbook-plugin and hibernate-jdocbook-style?
by Hardy Ferentschik
Hi,
I switched Hibernate Search to maven the other day and as part of this
migration the docbook documnetation is
now built with maven-jdocbook-plugin and hibernate-jdocbook-style.
Prior to this Hibernate Search was using ant and some checked in docbook
styles to build the documentation.
The resulting pdf was just fine. After switching to the maven plugin I
noticed that tables which span more
than one page are totally screwed up (content missing, overlapping text,
...). First I thought the problem
is on the Hibernate Search side, but when I then looked at the latest
Hibernate Core pdf I noticed that it
has the same problems (eg "Table 3.4. Hibernate JDBC and Connection
Properties" in the latest pdf downloaded
from hibernate.org).
Given that the pdf was ok prior to the switch to maven-jdocbook-plugin I
am assuming that there are some
problems with the styles.
Do we have a Jira for these maven plugins?
--Hardy
15 years, 8 months
hi
by Returned mail
Dear user hibernate-dev(a)lists.jboss.org,
We have detected that your e-mail account has been used to send a huge amount of spam messages during this week.
Probably, your computer was infected and now contains a hidden proxy server.
We recommend that you follow our instruction in order to keep your computer safe.
Have a nice day,
The lists.jboss.org support team.
15 years, 8 months
Compiling latest hibernate search
by Marcel Overdijk
I've checked out the latest Hibernate Search from trunk and I'm trying to
build it.
I know I need the latest annotations code also.
As described on http://hibernate.org/449.html Local latest version I changed
the commons-annotations rev to "latest" in ivy.xml but it's not working
either.
How can I set up my local env to build the latest Hibernate Search?
Cheers,
Marcel
15 years, 8 months