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.