1. generate sql scripts stackoverflow.comis there any hibernate utitliy that i can use to connect to database. list all the tables, and generate sql script for "creating tables + data" and save as *.sql ? ... |
2. Can Hibernate generate uppercase SQL? stackoverflow.comcan Hibernate generate uppercase SQL? I.e. some option which would make it send
instead of current
which I consider far less readable, esp. ... |
3. Can't generate HQL from SQL stackoverflow.com
I can't generate HQL for above mentioned ... |
4. Does this Hibernate generated SQL mean anything to anyone? coderanch.comGenerated sql: Hibernate: select hibernate_sequence.nextval from dual Hibernate: insert into PERSON (name, address, id) values (?, ?, ?) Everything seems to be working - no errors at all. But my class is not being saved to the database! I get the session, do the save, the flush etc - but no action in the database itself. Should I not be seeing ... |
5. Printing hibernate generated SQL coderanch.comIIRC Hibernate uses Log4j. You should be able to configure log4j to send different messages to different log files. Alternatively, you could post process the log file to extract just the messages you're interested it. This shouldn't be too hard with the usual Unix tools like grep, sed, awk, etc., or perl if necessary. I'm less familiar with simple text processing ... |
6. Valid HQL but generated SQL is invalid coderanch.comI wrote one error free HQL. Tomcat is up and running without compilation error. but when it got converted into SQL, it gave me some SQL grammar exception. I just changed the order of one join or fields and the problem disappear. I think (I am sure) that HQL was correct. Did anyone face this kind of issue before? I think ... |
7. Log4j Suppress JPA generated SQL coderanch.com |
8. Hibernate generate wrong SQL(One-to-One)? forum.hibernate.orgNewbie Joined: Mon Oct 12, 2009 5:08 am Posts: 1 Hi! I try to create iterator on Students, but I have wrong results and wrong generated SQL: Code: Query q = session.createQuery("from " + Student.class.getName() + " bo where bo.removed=:removed or (bo.archiveRelation is not empty and bo.archiveRelation.record.creationDate < :beforeDate)"); q.setParameter("removed", false); q.setParameter("beforeDate", beforeDate); return q.iterate(); But when I execute this HQL, ... |
9. Generated SQL is runs slow in Hibernate but fast manually forum.hibernate.orgA particular query that is generated by a Criteria runs slowly in Hibernate, about 4 seconds. If I take that same query and run it by hand then it runs very fast (.15 seconds). I am using Oracle and the table contains about million records. Not really noticing slowness agains the other tables, but this table contains a lot more records ... |
10. Generated SQL is runs slow in Hibernate but fast manually forum.hibernate.orgA particular query that is generated by a Criteria runs slowly in Hibernate, about 4 seconds. If I take that same query and run it by hand then it runs very fast (.15 seconds). I am using Oracle and the table contains about million records. Not really noticing slowness agains the other tables, but this table contains a lot more records ... |
11. Hibernate bug on generating SQL when using createAlias forum.hibernate.orgI am using Hibernate 3.5.1(Oracle10gDialect) and query with createAlias & Restrictions function as below HQL, it would generate wrong SQL. In the SQL, you can see ut2_.ID that is wrong SQL alias "ut2" and also add a colon before 'from' text "UPDATE12_22_0_, from" Is my HQL wrong or Hibernate bug? HQL ============================================= session = getSessionFactory().openSession(); coll = (Collection) session.createCriteria(Function.class). createAlias("application", "app"). ... |
12. Change the auto generated SQL from Hibernate forum.hibernate.org |
13. HQL and generated SQL forum.hibernate.orgHi I am writing a HQL, in which I have the following requirement. Say there are two tables Student and Department. in which crseDept, crseLevel and crseOption attributes values should be equal. crseOption can have null values. HQL: from Student stu, Department dept where stu.course = dept.course generates the following SQL. select * from Student stu, Department dept where stu.Dept_ID = ... |
14. Invalid Character in generated sql forum.hibernate.org |
15. Hibernate ant not generating sql forum.hibernate.orgI am trying to generate sql using ANT script, i am not getting any errors and its generating empty sql file. Could someone please check, My Java bean is, Code: import org.hibernate.annotations.Entity; import javax.persistence.Column; import javax.persistence.Version; @Entity public class Profile implements Serializable { private String name; @Version @Column ... |
16. Hibernate3.5.6 not generating Happy SQL for HSQLDB-2.1.0 forum.hibernate.orgFolks- I am trying to setup a Hibernate+HSQL application (Actually JPA/Hibernate). It has just one entity, Faculty, a 'hello world' type application. I was getting the following error: Code: 09:13:21,971 ERROR SchemaUpdate:212 - Unsuccessful: create table FACULTY (id numeric(19,0) identity not null, FIRST_NAME varchar(255) null, LAST_NAME varchar(255) null, primary key (id)) 09:13:21,972 ERROR SchemaUpdate:213 - primary key already exist After a ... |
17. api call to get sql generated from hql? forum.hibernate.orgHi, I think I saw that asked on the old forums but do not find it anymore. Is there a way to get the sql executed when doing: List result = null; try { result = sess.find(hqlquery); } catch (Exception e) { ... Right now I can only see the sql in the logs, but the used wants to see it ... |
18. Monitoring: how to get hibernate generated sql for monitor? forum.hibernate.org |
19. Bug in SQL Generation in Hibernate 2.1.1? forum.hibernate.orgNewbie Joined: Mon Dec 22, 2003 2:39 pm Posts: 8 Hibernate 2.1.1 generates the select statement below; I'm getting a jdbc "Invalid field name" message when it executes. It seems the where clause is using the name of the java field instead of the name of the sql field to do the query. When underscores are added to the field name ... |
20. Too much info in generated sql!? forum.hibernate.orgselect documento0_.id as id0_, versaodocu1_.id as id1_, versaodocu1_.documento_fk as document2_1_, documento0_.nome as nome0_, documento0_.descricao as descricao0_, documento0_.user_id as user_id0_, documento0_.dt_hr as dt_hr0_, documento0_.pasta_documento_fk as pasta_do6_0_, versaodocu1_.descricao as descricao1_, versaodocu1_.user_submissao as user_sub4_1_, versaodocu1_.data_submissao as data_sub5_1_, versaodocu1_.aprovado as aprovado1_, versaodocu1_.user_aprovacao as user_apr7_1_, versaodocu1_.data_aprovacao as data_apr8_1_, versaodocu1_.user_id as user_id1_, versaodocu1_.dt_hr as dt_hr1_, versaodocu1_.id as id__, (1) versaodocu1_.documento_fk as document2___ (2) from documento ... |
21. Unnecessary SQL generated forum.hibernate.org |
22. A trouble with generated SQL by Hibernate forum.hibernate.orgHibernate version: 2.1.6 I'm using a stupid RDBMS which has a bug with alias name in Select statement. When I use hibernate for one-to-many mapping with non-lazy initialization, this bug brings me trouble. The generated SQL is like the following: The generated SQL (show_sql=true): select instances0_.FACTORY_ID as FACTORY_ID__, instances0_.ID as ID__, instances0_.ID as ID0_, instances0_.URI_KEY as URI_KEY0_, instances0_.STATE as STATE0_, instances0_.NAME ... |
23. Hibernate Newbie: better sql generation forum.hibernate.orgHi--Here's the info, the question is down past the generated SQL Hibernate version: 2.16 Mapping documents (2 in total): Mapping doc 1: |
24. Generated SQL is Huge forum.hibernate.orgAuthor Message karokain Post subject: Generated SQL is Huge Posted: Tue Dec 14, 2004 1:10 pm Newbie Joined: Mon Aug 09, 2004 8:27 pm Posts: 15 Location: Brazil First off, all my persistent objects extend PersistentObject so they can utilize some system properties common to all persistent objects (for example: created date, modified date, created by, modified by) This ... |
25. SQL generated does not work forum.hibernate.org[b]Hibernate version:[/b] 2.1.8 on MySQL This issue was found in the TOOLS forum, but after reading my addition to the post, you'll see it appears that it is not a tool(xml generator) issue, so I'm posting a link here. The issue is.. HSQL taking form "from tablename" does not work, but the same hbm.xml works for form "from tablename e where ... |
26. 'elements' or 'indices' - Does not generate SQL forum.hibernate.orgCan some tell what i am missing in the following HQL: I have one-to-many relation between CalEvent and LaneDtls classes. In CalEvent.java and CalEvent.hbm.xml files i have LaneDtls referred with Set. I just want to find out what syntactically i am missing in HQL. Please help HQL: *** FROM CalEvent event left join fetch event.laneDtls WHERE (event.start_date <= :bindStart AND event.end_date ... |
27. Human readable generated sql? forum.hibernate.orgHi, I was wondering if there is any work underway to make Hibernate generate human readable sql, that is, sql without all of those unecessary and weird names aliases for both fields and table names. I understand having a unique way of addressing them is necessary to make the or-mapper work, but the current solution (at least with Hibernate 2.1.8, don't ... |
28. generated 4 sql per row forum.hibernate.org |
29. Modify SQL requests generated by Hibernate forum.hibernate.org |
30. How to view the generated SQL forum.hibernate.orga5sk4s wrote: Use hibernate.show_sql true in either hibernate.properties or the corresponding XML syntax in hibernate.cfg.xml I already have that and this is what I see in the console The reason why I want to see this is I am not able to retrieve an Object and I thought looking at the sql would a starting point and then I can move ... |
31. more readable generated SQL? forum.hibernate.orgHow can I get more readable generated SQL? Turning on SQL logging, I get code which looks like this select project0_.project_id as project1_, project0_.project_name as project2_16_, project0_.project_description as project3_16_, project0_.commission_datetime as commission4_16_ ... from project project0_ The problem is that the alias names are nonsensical from a user point of view . When I run the same select in a SQL ... |
32. help!! Wrong SQL being generated forum.hibernate.orgHibernate version:3.1beta1 Code between sessionFactory.openSession() and session.close(): Code: HibernateCallback callback = new HibernateCallback(){ public Object doInHibernate(Session session) throws HibernateException, SQLException { Query query = session.createQuery("select count(distinct specie) from Specie specie where specie.tradeNames like '%" ... |
33. Actual SQL generation - Debugging information forum.hibernate.orgHi everyone, Does anyone know how to find the exact Sql query (with the data) that Hibernate fires to the Database. For example.. by turning on the show_sql to true .. i can get information like the following: Hibernate: insert into studentaddress (EnquiryId, AddressType, street1, street2, city, state, pincode) values (?, ?, ?, ?, ?, ?, ?). But then what is ... |
34. using backticks generates incorrect SQL forum.hibernate.orgIn using backticks to quote an SQL Server reserved word (in an arbitrary where clause on a collection mapping), and I have found the the SQL generated by Hibernate changes. The immediate obvious solution is to remove the backticks and change the table name, but surely this is a bug? Has anyone else come across this? I include the generated SQL ... |
35. Strange generated sql from hql forum.hibernate.orgNewbie Joined: Fri Mar 24, 2006 10:29 am Posts: 1 Location: Gothenburg Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp hib 2.1.8 jdk 1.5 oracle 9.2.0.4 Hello! I am currently implementing a bidirectional one-to-one FK association based on the many-to-one (unique) + one-to-one (property-ref) technique described in "Hib in action" (p.221-223). Everything worked well until i stumbled over a ... |
36. Using Hibernate and not generating any SQL forum.hibernate.orgHi I'm evaluating Hibernate 3.2 CR for a project where all database access must be via stored procedures. If any non-SP SQL is used to query the DB, I'm gonna be in a lot of trouble! So, is it possible to use Hibernate and map associations to sets without any SQL being generated by Hibernate. I've tried using |
37. Newbie q: Non-escaped / quoted literals in generated SQL forum.hibernate.orgHibernate version: 3.1 Spring Framework version: 1.2.7 Full stack trace of any exception that occurs: [junit] Testcase: testComments(com.mediagraft.podsplice.dao.hibernate.Hibern ateCommentaryDAOTest): Caused an ERROR [junit] Hibernate operation: Could not execute JDBC batch update; bad SQL gr ammar [insert into comments (username, date, rating, subject, text, comment_id) values (?, ?, ?, ?, ?, ?)]; nested exception is java.sql.BatchUpdateException: B atch entry 0 insert into ... |
38. Is this a bug in SQL generation from HQL? forum.hibernate.orgNeed help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.1.2 Mapping documents: |
39. Invalid generated SQL for Restriction.in() forum.hibernate.orgIt seems that the SQL generated by Hibernate in case of using criteria.add(Restriction.in("id", collection)); to filter data, can not be executed by databases if the collection is NULL or EMPTY. This happens because the generated SQL looks like: select * from USERS where id in () and this is for sure not supported by SQL syntax. Does anybody have any idea ... |
40. Bad sql generated with DetachedQuery forum.hibernate.orgHibernate version: hibernate 3.2.0 cr2 hiberate-annotations 3.2.0 cr1 I have the following criteria: DetachedCriteria crit = DetachedCriteria.forClass(getEntityClass()) .createAlias("categories", "cat") .createAlias("cat.allParents", "category") .createAlias("category.allChildren", "child") .createAlias("child.cards", "card") .add(eqProperty("id", "card.id")) .add(eq("category.id", cat.getId() )) .setProjection(distinct(property("id"))); return createCriteria(getSession()) .add(Subqueries.propertyIn("id", crit)); When I run the first block as it's own query it executes fine. But used as a detached query (as a subquery) i get the following: ... |
41. Wrong SQL generated for formulas ? forum.hibernate.orgHi, I have exactly the scenario as described in Chapter "7.6. More complex association mappings" I have a historized table "leaf" which includes 4 columns "lid", "start", "end" and "parentid" where parentid points to another lid. So the content could be something like this: lid, start, end, parentid 1, 2006-09-01, 2006-09-02, NULL 1, 2006-09-02, NULL, NULL 2, 2006-09-02, NULL, 1 First ... |
42. Odd SQL generated for one-to-many forum.hibernate.orgEnvironment: Java 5 Tomcat 5 Hibernate 3.2 cr2 Spring 2.0 rc3 Oracle 9i Windows XP Eclipse 3.1 I want to create a unidirectional one-to-many from an Employment record to BenefitEligibility records. So I created the following mapping for Employment: Code: |
43. is it possible to enrich every generated sql with audit info forum.hibernate.org |
44. Hibernate generates wrong sql :( forum.hibernate.orgNewbie Joined: Fri Nov 03, 2006 6:53 am Posts: 5 Hello ! I've the following problem Hibernate generates wrong sql address0_.USER_ID=? and address0_.ROW_ID=? for a.user.userId=? and a.addressType.id=? it takes address0_.ROW_ID instead of addressType.id I've posted hbm and whole generated sql Hibernate version: 3.1 Mapping documents: Code: |
45. LIMIT added to generated sql forum.hibernate.orgHi, We have a query that is performed regularily in our application. The first few times things go fine, but then it starts to return only a single row. From the log I can see that 'limit ?' is added to the generated SQL. I've tried different variants of the query, and also invoking it in different ways (directly via Spring's ... |
46. Hibernate 3.1.3 generating invalid SQL forum.hibernate.orgHibernate 3.1.3 is generating invalid SQL for some HQL statements (on SQLServer). Mappings: Code: |
47. Hibernate generates wrong SQL code. forum.hibernate.orgBeginner Joined: Mon Mar 20, 2006 7:59 am Posts: 30 I'm not sure whether my code helps a lot. Let me just show you how I was using JPA-annotations to define the dependencies between my classes: Code: @Entity @Table(name = "Events") public class Event extends Persistent { /** * Versions-ID, die fr die Serialisierung ... |
48. how to display exact generated/sent SQL forum.hibernate.org |
49. Incorrect SQL generated from HQL forum.hibernate.orgHibernate version: 3.2.2 I have written a HQL query that retrieves a set of objects that are mapped from a parent object. The SQL that is generated from it is incorrect. I have discovered that the ORDER BY clause is causing the problem. I will include the HQL that generates the incorrect join in SQL and the HQL that generates the ... |
50. How to extract SQL generated by Hibernate forum.hibernate.orgsorry, i dont know if it is possible. probably you are asking because you will use hibernate as "sql generator" and execute the generated sql by other means -- if so (just guessing) -- i have only partial solution for Python :-) -- i know only of Python to be able to incorporate hiberante (using Jython). But in case of Python, ... |
51. modifications to generated SQL for optimization? forum.hibernate.orgHi, I have a MySQL sepcific question: I would like to use an optimized query using "SELECT STRAIGHT_JOIN ...", i.e. I would like to do some modification to the generated SQL. Any possibility using this in combination with Hibernate without writing plain SQL? This is a really big performance issue in our project so it would be incredibly useful. Thanks for ... |
52. Generating sql forum.hibernate.orgI need to create views from hql queries, or use them as inline views for larger sql queries. Hibernate doesn't support this, but a dirty hack comes to my mind. Hibernate somehow generates its sql, prepares the statements, sets parameters and sends the query to the database. If I could trick hibernate into giving me the generated sql and the paramters ... |
53. Global Static SQL Generation forum.hibernate.orgI've been searching for information on this and I apologize if it is addressed elsewhere. I know you can tell Hibernate to load the SQL for a given class at runtime instead of at startup. Is there a way to do this globally for all entities? We want to do this to reduce startup time during development. |
54. Adding hints to SQL generated from SQL forum.hibernate.orgHi, I've read in a few posts that in order to add hints to SQL that is generated from HQL, one can use the Query.addComment() method. The problem is that the comment is added at the begininng of the query, and Oracle expects it after the SELECT keyword, e.g. select /*+ FULL(emp_status) */ empname, status from emp_status where status = 'P'; ... |
55. Incorrect SQL being generated for IN forum.hibernate.org |
56. Incorrect SQL generated forum.hibernate.orgHi, I am facing the problem where for given HQL, incorrect SQL is generated. An association betwwen classes is as follows: 1 . Participant has one-to-many ParticiapantMedicalIdentifier (UniDirection) 2. ParticiapantMedicalIdentifier has many-to-one Site. (UniDirection) Hibernate version:3.0 [b]Mapping documents: Code between sessionFactory.openSession() and session.close(): String hql1 = "From edu.wustl.catissuecore.domain.Participant as xxTargetAliasxx where xxTargetAliasxx.participantMedicalIdentifierCollection.id in (select id From edu.wustl.catissuecore.domain.ParticipantMedicalIdentifier where site.id in (select ... |
57. sql script generation forum.hibernate.orgpublic static void main(String args[]) { AnnotationConfiguration config = new AnnotationConfiguration(); config.addAnnotatedClass(User.class); config.configure(); new SchemaExport(config).create(true, true); } |
58. PostgresDialect generating invalid SQL. How to resolve? forum.hibernate.orgNewbie Joined: Sun Oct 26, 2008 12:47 pm Posts: 1 Hibernate version: 3.2.5.ga, 3.3.1ga Mapping documents: The relevant HBM files follow (originally one class per file): Code: |
59. incorrect generated SQL from EJBQL forum.hibernate.orgNewbie Joined: Fri Nov 21, 2008 10:38 am Posts: 3 Location: Germany Hello, i'm using JBoss AS 4.2.3.GA. I have an Entity Schmelze with two One-To-One bidirectional relationships SollSchmelze and VerlustSchmelze which have an embedded Attribut PlanungsNummer: Code: @Entity public class Schmelze implements Serializable { ... private SollSchmelze sollSchmelze; private VerlustSchmelze verlustSchmelze; ... |
60. incorrect generated SQL from EJBQL forum.hibernate.orgNewbie Joined: Fri Nov 21, 2008 10:38 am Posts: 3 Location: Germany Hello, i'm using JBoss AS 4.2.3.GA. I have an Entity Schmelze with two One-To-One bidirectional relationships SollSchmelze and VerlustSchmelze which have an embedded Attribut PlanungsNummer: Code: @Entity public class Schmelze implements Serializable { ... private SollSchmelze sollSchmelze; private VerlustSchmelze verlustSchmelze; ... |
61. incorrect generated SQL from EJBQL forum.hibernate.orgNewbie Joined: Fri Nov 21, 2008 10:38 am Posts: 3 Location: Germany Hello, i'm using JBoss AS 4.2.3.GA. I have an Entity Schmelze with two One-To-One bidirectional relationships SollSchmelze and VerlustSchmelze which have an embedded Attribut PlanungsNummer: Code: @Entity public class Schmelze implements Serializable { ... private SollSchmelze sollSchmelze; private VerlustSchmelze verlustSchmelze; ... |
62. Crazy SQL generated off HQL forum.hibernate.orgHi, I'm getting a really inefficeint SQL query generated off my HQL. I am obviously doing something wrong, can someone help? I have not executed the query to completion, it takes too long. There are two tables, SubscriptionNotification and subscribedStructures. The generated SQL seems to perform joins to the same table 10 or so times, on the same foriegn key. HQL: ... |
63. proxy getId => why sql is generated ! forum.hibernate.orgHello, I've a persistent object that reference other entity objects with manyToOne or oneToOne associations in LAZY fetch mode. When I load this object (with entityManager.find for example), Hibernate create a proxy for each associated object. It's normal But if I get the Id from an associated object, a sql staement is generated ! I thought hibernate didn't need sql statement ... |
64. Generated SQL is incorrect forum.hibernate.orgNewbie Joined: Wed Jun 17, 2009 5:05 pm Posts: 3 I am trying to port an existing application to jboss, ejb3, hibernate/jpa, and mysql. I have two tables that represent a one-to-many relationship between a "link" and an "analytic entry". When I select a "link" the "analytic entry" query (lazy=false) is incorrect and I get an exception that the column is ... |
65. generate sql scripts forum.hibernate.org |
66. Generated SQL is used even after Loader is defined forum.hibernate.orgIn my prototype project using Hibernate 3.4.0.GA, I have defined a |
67. Invalid SQL Generation forum.hibernate.orgHi, I'm not sure If this would solve the issue but out of curiosity why do you need an alias when you have just one Entity/Table in the query? Have you tried this removing the alias?:- |
68. Hibernate is generating wrong SQL forum.hibernate.orgNewbie Joined: Tue Jun 16, 2009 4:11 pm Posts: 8 When I execute the following HQL, hibernate is generating a wrong SQL instruction: Code: 1. StringBuffer hql = new StringBuffer(); 2. hql.append(" select gau.id ... |