-->
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.  [ 2 posts ] 
Author Message
 Post subject: How to create database table using hql
PostPosted: Wed Jul 21, 2004 12:10 pm 
Newbie

Joined: Wed Jul 21, 2004 7:44 am
Posts: 7
Version : 2.1.2

No problem with mapping files since they were created and tested using "from" and "select" statements.

Database is : SQL Server 2000
code--(If I try to execute this query using createSQLQuery() method it neither gives any exception nor creates the table. If I try it use java.sql methods table does get created.)

String CREATE_REPORT_TABLE = "begin " +
"create table transfer_report (" +
"ID int IDENTITY (1,1) PRIMARY KEY, " +
"name varchar(20) NOT NULL," +
"first_name varchar(7) NOT NULL," +
"last_name varchar(7) NOT NULL )" +
"end";
try{
Session con = ServiceLocator.getSessionFactory().openSession();
Debugger.debugMessage("In Test JSP","Before --");
try{
con.createSQLQuery (CREATE_REPORT_TABLE,null,TrasferReportVO.class);
}catch(Exception he){
Debugger.debugMessage("In Test JSP","Exception is raised: "+he);
}
Debugger.debugMessage("In Test JSP","After --");
con.close();
}catch(Exception he){
Debugger.debugMessage("In test JSP","Exception name - "+he);
}


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 21, 2004 1:43 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
you cannot do this, sqlquery is usable only if there are objects mapped with the tables you want to use.
take a look at schema export tool

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.