-->
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.  [ 1 post ] 
Author Message
 Post subject: sql formatter
PostPosted: Wed Dec 29, 2010 6:26 pm 
Beginner
Beginner

Joined: Sat Oct 09, 2004 2:35 pm
Posts: 43
Location: Tenerife
Quote:
I posted this message into "hibernate tools" but I was told it is a hibernate-core problem:



SchemaExport does not respect format from entered input.
Statements coming from <database-object><create> xml file are generated into database as a whole line. No way that they are perfectly formatted.

Statement entered:

Code:
<database-object>
    <create>   
<![CDATA[
create procedure
   GRP_CONSTRAINTS(inout p_es_administrador char(1),
                   inout p_version          bigint)
   comment 'Restricciones de Grupo'
   /**
   * Constraints DEFAULT y CHECK
   * Author: JMR
   **/
begin
   if(p_es_administrador is null) then
      set p_es_administrador = 'F';
   end if;
   if(p_VERSION is null) then
      set p_VERSION = 0;
   end if;
   if(p_ES_ADMINISTRADOR <> 'F'
      and p_ES_ADMINISTRADOR <> 'T') then
      signal sqlstate '45000'
      set message_text = 'ES_ADMINISTRADOR ha de ser "F" o "T"';
   end if;
   if(p_VERSION < 0) then
      signal sqlstate '45000'
      set message_text = 'La VERSION ha de ser mayor o igual a 0';
   end if;
end
]]>
    </create>
    <drop>
drop procedure if exists GRP_CONSTRAINTS
    </drop>
<dialect-scope name="org.hibernate.dialect.MySQL5InnoDBDialect" />
</database-object>


Exit from console looks like this:

Code:
create procedure GRP_CONSTRAINTS(inout p_es_administrador char(1), inout p_version bigint) comment 'Restricciones de Grupo' /** * Constraints DEFAULT y CHECK * Author: JMR **/ begin if(p_es_administrador is null) then set p_es_administrador = 'F'; end if; if(p_VERSION is null) then set p_VERSION = 0; end if; if(p_ES_ADMINISTRADOR <> 'F' and p_ES_ADMINISTRADOR <> 'T') then signal sqlstate '45000' set message_text = 'ES_ADMINISTRADOR ha de ser "F" o "T"'; end if; if(p_VERSION < 0) then signal sqlstate '45000' set message_text = 'La VERSION ha de ser mayor o igual a 0'; end if; end;


Any solution to this?


vyemialyanchyk had a look at this problem and stated this:

the source of the problem is
org.hibernate.cfg.HbmBinder
in hibernate-distribution-3.5.6-Final-dist.zip
strings [270-273]:
Code:
         auxDbObject = new SimpleAuxiliaryDatabaseObject(
               auxDbObjectNode.elementTextTrim( "create" ),
               auxDbObjectNode.elementTextTrim( "drop" )
            );


auxDbObjectNode.elementTextTrim - return string without line separators and formatting
to preserve formatting in necessary to use elementText(String name) instead of elementTextTrim.
This is internal Hibernate issue, not a Hibernate Tools.
Please, create Hibernate issue with the problem description.


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

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.