Steve Deadsea

Ranch Hand
+ Follow
since Dec 03, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Steve Deadsea

Finally figured it out.

The problem is c.buildSessionFactory(new ServiceRegistryBuilder().buildServiceRegistry());

c.buildSessionFactory() is the way to go, even though it has been deprecated in hibernate 4.0.0.
Looking into what it does, it creates a serviceregistry and then copies the properties from the configuration over into the serviceregistry. It is not enough to use an empty service registry. It appears that the intent was to deprecate the entire Configuration class in hibernate 4.0.0. I have not found a hibernate configuration example that only uses the service registry and does not use configuration yet.

I chalk this up to the unhelpful deprecation documentation on c.buildSessionFactory().
I've been beating my head against this issue with hibernate all day. It appears to me that hibernate is not finding the properties that I'm setting and its complaining about 'hibernate.dialect' not being set. But its also complaining about 'no appropriate connection provider', so I'm not sure what the root issue is. In any case, I've boiled it down to a small test case the demonstrates the problem:



$ ls -1 lib
antlr-2.7.7.jar
c3p0-0.9.1.jar
classmate-0.5.4.jar
commons-beanutils-1.7.0.jar
commons-chain-1.1.jar
commons-collections-3.2.1.jar
commons-digester-1.8.jar
commons-lang-2.4.jar
commons-logging-1.1.jar
commons-validator-1.3.1.jar
dom4j-1.6.1.jar
hibernate-c3p0-4.0.0.Final.jar
hibernate-commons-annotations-4.0.1.Final.jar
hibernate-core-4.0.0.Final.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
jandex-1.0.3.Final.jar
javassist-3.12.1.GA.jar
jboss-logging-3.1.0.CR2.jar
jboss-transaction-api_1.1_spec-1.0.0.Final.jar
oro-2.0.8.jar
servlet-api-2.5.jar
slf4j-api-1.6.1.jar
slf4j-simple-1.6.1.jar
sslext-1.2-0.jar
struts-core-1.3.8.jar
struts-taglib-1.3.8.jar
struts-tiles-1.3.8.jar
velocity-1.7.jar
velocity-tools-2.0.jar
xml-apis-1.0.b2.jar


$java test.HibernateConfig
Jan 11, 2012 10:28:35 PM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
Jan 11, 2012 10:28:35 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.0.0.Final}
Jan 11, 2012 10:28:35 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Jan 11, 2012 10:28:35 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Jan 11, 2012 10:28:35 PM org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator initiateService
WARN: HHH000181: No appropriate connection provider encountered, assuming application will be supplying connections
Exception in thread "main" org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set
at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:97)
at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:67)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:170)
at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:71)
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2270)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2266)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1735)
at test.HibernateConfig.getHibernateSessionFactory(HibernateConfig.java:29)
at test.HibernateConfig.main(HibernateConfig.java:35)


All the jar files that I listed in the lib directory are in my classpath. Maybe I'm missing something. Maybe I don't have the syntax for the configuration correct. I can't figure it out at this point. Can anybody help?
I thought that maven worked at the jar level, not at the class level. No?
14 years ago
A few years ago I could have sworn that I read about a jar creation tool that would automatically discover what class files would be needed for a application and build a jar file with just those class files. I believe that you provided it with the name of the class or classes that had entry points (main methods) and it would see what they depended on usiing static analysis. It would look at both things that were compiled as dependencies and things that might be dependencies because of strings that looked like class names to load via reflection.

Such a tool would be really useful to me now, but I can't seem to find it on Google right now. Is anybody familiar with it?
14 years ago
I would agree that the geographical coverage in peru isn't all that great. There is a development team that is working on getting more complete geography for the less traveled places in the world.
16 years ago
TripAdvisor has a travel map that have have marked with all the places in the world that I visited:
http://www.tripadvisor.com/members/deadsea

Where have you traveled? Sign in and create your own travel map and link to your profile URL here.

I work for TripAdvisor and we just rolled out the travel map and I thought I would share it with everybody here.
16 years ago
I'd say that multiplex most closely means "handle multiple" or "deal with multiple" in this instance.

It used to be that you would get stuck on any single stream because you would try to read from it and wait minutes for data to come in on that stream. In the meantime data would come in on your other streams and your single threaded program would appear to be hung and unresponsive.
19 years ago
Switch to Linux. Unlike Windows, Linux doesn't put silly restrictions like that on files. Multiple programs can have a file open and one program can delete a file even when another is using it (it won't actually go away until the other program is done with it)
19 years ago
I recently wrote an article that explains how to convert an outputstream to an inputstream using any one of three methods: byte arrays, piped streams, or circular buffers.

http://ostermiller.org/convert_java_outputstream_inputstream.html
19 years ago
I'd get out a packet sniffer and see exactly what the headers are as they are being sent across.

For firefox, this is easy to do with the live headers plugin, but for ie, you will need a packet sniffer.
19 years ago
Use the append parameter to the FileWriter constructor:
new FileWriter(path + "\\"+ navbarindex, true)
19 years ago
If you are using a hashtable for each record, that might be some part of the problem. I don't know how big the default size for a hash table is, but it could have hundreds or thousands of entries when you are using only four. You can specify the size of the hashtable you want when you create it. Alternatly, I might suggest creating a new object type called Record that implements the Comparable interface and has a field for each of name, address, etc.
21 years ago
Why a makefile? They are not suited to the task that you propose. Make does not pass command line arguments to tasks, so you would not be able to specify how many times you wanted to run the task.
Make is designed to build files when another file it depends on changes.
The only way I see this working is if you had some number in one file, say in.txt and you always wanted the number in some othe file, say out.txt to be 10 greater. In that case you might set up a makefile like this: ([tab] means a tab character goes there)
out.txt: in.txt
[tab]cat in.txt | java add 10 > out.txt
Any time that in.txt changed, you could type make and out.txt would be updated.
To add in the number of times that you wanted this to execute, I would think that have to write a wrapper script. Make has no concepts of loops or branches.
[ November 05, 2002: Message edited by: Steve Deadsea ]
21 years ago