-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Dialect.getKeywords() returns an empty set
PostPosted: Thu Oct 20, 2011 3:08 pm 
Newbie

Joined: Thu Oct 20, 2011 11:43 am
Posts: 1
I am new to Hibernate and am using 3.6.6 to interact with an Oracle 11g database instance.
The application that I am working on requires the identification of DBMS specific keywords.
I attempted to use the Dialect.getKeyWords() method against an Oracle 11g instance via the Oracle10gDialect.
However, the method returns an empty set of Strings.
The snippets below are the hibernate.cfg.xml and source code stub respectively.
Is there a method call or config entry that I've omitted?
What am I missing?

hibernate.cfg.xml

<hibernate-configuration>
<session-factory name="importDefPOC_session">
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.password">xxx</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@server:port:sid</property>
<property name="hibernate.connection.username">userID</property>
<property name="hibernate.default_schema">SchameName</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.connection.pool_size">1</property>
<property name="hibernate.current_session_context_class">thread</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<property name="hibernate.session_factory_name">importDefPOC_session</property>
<property name="hibernate.jdbc.batch_size">50</property>
<mapping resource="Some mapping 1..."/>
<mapping resource="Some mapping 2..."/>
<mapping resource="Some mapping 3..."/>
</session-factory>
</hibernate-configuration>


HibernateUtil.java

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import java.util.Set;
import org.hibernate.dialect.Dialect;
import org.hibernate.Session;

public class HibernateUtil
{
private static final Configuration config = buildConfiguration();
private static final SessionFactory sessionFactory = buildSessionFactory();
private static final Set<String> reservedWords = buildKeyWords();

private static Configuration buildConfiguration()
{
try
{
return new Configuration().configure();
}

catch ( Throwable ex )
{
System.err.println( "Initial SessionFactory creation failed." + ex );
throw new ExceptionInInitializerError(ex);
}
}


private static SessionFactory buildSessionFactory()
{
try
{
return config.buildSessionFactory();
}

catch ( Throwable ex )
{
System.err.println( "Initial SessionFactory creation failed." + ex );
throw new ExceptionInInitializerError(ex);
}
}

private static Set<String> buildKeyWords()
{
Dialect thisDialect;
Set<String> retVal;

// Initialize stuff
retVal = null;

try
{
thisDialect = Dialect.getDialect( config.getProperties() );
retVal = thisDialect.getKeywords();
}

catch ( Exception e )
{
e.printStackTrace();
}

return( retVal );
}

public static SessionFactory getSessionFactory()
{
return HibernateUtil.sessionFactory;
}

public static Set<String> getKeyWords()
{
return( HibernateUtil.reservedWords );
}
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.