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.  [ 5 posts ] 
Author Message
 Post subject: Crazy functioning
PostPosted: Thu Oct 16, 2008 1:45 pm 
Newbie

Joined: Sun Mar 30, 2008 2:06 pm
Posts: 7
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
hibernate-3.2
Mapping documents:
I am using anotations!
Code between sessionFactory.openSession() and session.close():
final Configuration cfg = new Configuration();
cfg.configure();
SessionFactory sf = cfg.buildSessionFactory();

Session s1 = sf.openSession();
if( s1.isConnected())
System.out.println("Connected!");
else
System.out.println("Disconnected!");
sf.close();
Full stack trace of any exception that occurs:
Connected!
Name and version of the database you are using:
Sql Server 2005
The generated SQL (show_sql=true):
None
Debug level Hibernate log excerpt:
don't know how to debug level.

Problems with Session and transaction handling?

The problem is this!
Hibernate is eating everything i give it, and runing as if the world was blue and shiny... when it should be reporting what really is going on!

I've tried both placing incorrect password (in my xorg config), and totally desabling the network cable (the RDBMS is on another host)...
And it still says that it the sessions is connected.
I am using SQL Server JDBC driver.

"com.microsoft.sqlserver.jdbc.SQLServerDriver"

which i downloaded from microsoft's website.

Furthermore, i've tried executing exporting one entities schema (there is only one so far):

the code follows next ->


AnnotationConfiguration cfg;
cfg = new AnnotationConfiguration();
cfg.addAnnotatedClass(businesslogic.Profile.class);
cfg.configure();
final SchemaExport se = new SchemaExport(cfg);
se.create(true, true);



Again no errors to report.
No relation is created,
and more importantly... not even the DML is printed.
Either the cfg doesn't realize it has an annotated class inside, or simly the tool is malfunctioning?

Something is off!
Read this: http://hibernate.org/42.html

[/i]

_________________
"close this world and open the next." Serial Experiments Lain


Top
 Profile  
 
 Post subject: managed to get an hibernate complain
PostPosted: Thu Oct 16, 2008 2:32 pm 
Newbie

Joined: Sun Mar 30, 2008 2:06 pm
Posts: 7
i managed to get hibernate to complain:

after issuing the command:


System.out.println(s1.connection().getCatalog());

app crashed with toubles with the jdbc connection:


Exception in thread "main" org.hibernate.exception.JDBCConnectionException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.jdbc.BorrowedConnectionProxy.invoke(BorrowedConnectionProxy.java:50)
at $Proxy6.getCatalog(Unknown Source)
at scripts.Test.main(Test.java:34)
Caused by: java.sql.SQLException: No suitable driver found for jdbc:microsoft:sqlserver://192.168.0.10:1433;databasename=hibernate_tese
at java.sql.DriverManager.getConnection(DriverManager.java:602)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
... 4 more




i figure either my conection url is wrong (but i am sure i didn't come up with the syntax, by mistake...
or hibernate is messing with the driver.

_________________
"close this world and open the next." Serial Experiments Lain


Top
 Profile  
 
 Post subject: trouble at paradise
PostPosted: Thu Oct 16, 2008 2:42 pm 
Newbie

Joined: Sun Mar 30, 2008 2:06 pm
Posts: 7
well i've managed to detect that url syntax was wrong, in a connectiong example that came with the driver.

so some render site lead me wrong.

still there are toubles at paradise, but i am gonna try to figure them out for a second longer.


anyway, still regarding my last post, i find it very disturbing that hibernate reports to me:

Oh! You are connected don't worry. the session is open and well.

But when i tell hibernate, shut up and pass me the connection... let me mess with it for a second: it goes
sorry the connection was all screwed up after all, now i gotta crash your application. have fun!


Nice one.

_________________
"close this world and open the next." Serial Experiments Lain


Top
 Profile  
 
 Post subject: problem found
PostPosted: Thu Oct 16, 2008 5:15 pm 
Newbie

Joined: Sun Mar 30, 2008 2:06 pm
Posts: 7
well, as for my problems so far...
they seem resolved.

The driver could not connect because: 1st, the url syntax was wrong;
2nd, i had two sql server intances, and the one online didn't listen on the standart port 1443.

So there could never be a connection established.


As for why the Hibernate: session open, session.isconnected and so on... never returned any errors, that still remains a mistery to me.

What i am sure of, the ambiguous way in which Hibernate seems to function is not making my life any easier, geting to the root of the problems.


If anyone has any idea on why no exception was throw by my initial code where i reming you: Both password, Listen port, and jdbc URL were completly wrong...

I would appreciate.

Furthermore, i'd like to know, why No SQL was printed when order the Exportation of the schema!

Does the command only print out, after the normal execution?

Thanks in advance.

_________________
"close this world and open the next." Serial Experiments Lain


Top
 Profile  
 
 Post subject: ...
PostPosted: Mon Oct 20, 2008 8:15 am 
Newbie

Joined: Sun Mar 30, 2008 2:06 pm
Posts: 7
no one can explain it?

_________________
"close this world and open the next." Serial Experiments Lain


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

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.