-->
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: Problems with the @SQLInsert ...
PostPosted: Mon Oct 15, 2007 11:39 am 
Newbie

Joined: Tue Oct 09, 2007 4:44 am
Posts: 6
Code:
@Entity
@Table(name = "CONTACTS")
@SQLInsert(sql="INSERT INTO CONTACT(FIRST_NAME, LAST_NAME) VALUES(upper('aaa'),upper('bbb'))")
public class Contact {
// ...
}


I've tried the both - sql-query and stored procedure inside the @SQLInsert. But the both not work for me. It looks like the @SQLInsert annotation is just ignored for some reason. Usual "insert into CONTACT (FIRST_NAME, LAST_NAME) values (?, ?)" statement is generated despite of the @SQLInsert annotation. At the same time other annotations (@NamedNativeQuery, @Loader) work ok for the class.

How to make it works, please?

Thanks a lot in advance.



Hibernate version:
hibernate-3.2.3.ga.zip
Mapping documents:
Code:
  sessionFactory = new AnnotationConfiguration()
   .addPackage("model")
   .addAnnotatedClass(Contact.class)
   .addAnnotatedClass(SpaceShip.class)
    .setProperty("hibernate.dialect", "org.hibernate.dialect.MySQLMyISAMDialect")
    .setProperty("hibernate.connection.url", "jdbc:mysql://localhost/test")
    .setProperty("hibernate.connection.driver_class", "com.mysql.jdbc.Driver")
    .setProperty("hibernate.connection.username", "usname")
    .setProperty("hibernate.connection.password", "1231123")
    .setProperty(Environment.HBM2DDL_AUTO, "update")
    .setProperty(Environment.SHOW_SQL, "true")
    .setProperty("hibernate.cache.provider_class", "org.hibernate.cache.NoCacheProvider")
   .buildSessionFactory();

Code between sessionFactory.openSession() and session.close():
Code:
         session = HibernateUtil.getSession();
         session.beginTransaction();
         session.saveOrUpdate(newContact);
         session.getTransaction().commit();

Full stack trace of any exception that occurs:
None
Name and version of the database you are using:
MySQL client version: 5.0.22
The generated SQL (show_sql=true):
Hibernate: insert into CONTACT (FIRST_NAME, LAST_NAME) values (?, ?)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 16, 2007 11:27 am 
Newbie

Joined: Tue Oct 09, 2007 4:44 am
Posts: 6
up


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 17, 2007 8:48 am 
Newbie

Joined: Tue Oct 09, 2007 4:44 am
Posts: 6
Any one here who use the @SQLInsert? Help, please.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 18, 2007 9:21 am 
Newbie

Joined: Tue Oct 09, 2007 4:44 am
Posts: 6
Still unresolved :(


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 28, 2008 1:14 pm 
Newbie

Joined: Thu Feb 28, 2008 12:56 pm
Posts: 1
Hi, I have the same problem!
is this the only way to execute a "INSERT INTO" statement with a declarative clause?
thanks a lot


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.