Hi again Shyam and thanks for reply. Well, I tried change index name and doesn't work. I don't generate DB because it is created and working in an application client-server, so I have had problems running unit test for DAO.
This is table definition:
Table Dump Table Field Index Table
Name Name Flags Count Count Label
----------------------------- -------- ----- ----- ----- -------------------
cliente cliente 68 25 ?
Description: una agenda de clientes
Storage Area: Schema Area
============================= FIELD SUMMARY =============================
============================= Table: cliente ============================
Flags: <c>ase sensitive, <i>ndex component, <m>andatory, <v>iew component
Order Field Name Data Type Flags Format Initial
----- ------------------------- ----------- ----- --------------- ----------
5 cvecliente inte im ->>>>>9 0
10 nombre char im x(50)
20 Telefono1 char xxx-xxx-xxxx
30 Telefono2 char xxx-xxx-xxxx
35 Fax char xxx-xxx-xxxx
50 Notas char[10] x(65)
60 rfc char i xxxx-xxxxxx-xxx
70 limitecredito deci-2 ->>,>>>,>>9.99 0
80 condicion inte >>>>>9 0
90 estatus logi m Activo/Desactiv yes
100 cveempresa inte i >>>>>9 0
110 cli_rel inte i >>>>>>9 0
120 interno logi Si/No no
130 saldo deci-3 i ->>,>>>,>>9.99 0
140 cveagente inte i >>>>9 0
150 nomabr char i x(11)
160 cvecuenta inte i >>>>>>9 0
170 cvetipocliente inte i >>>>>>9 0
190 preciofdirecto inte > 0
260 fecha date 99/99/99 TODAY
270 calleynumero char x(52)
280 colonia char x(28)
290 ciudad char x(28)
310 delegacion char x(28)
320 estado char x(20)
330 cp char x(8)
340 cvetipocambio inte >>>>>9 1
350 web char x(30)
360 email char x(30)
370 factoraje logi i Si/No no
380 poraplicar deci-2 ->,>>>,>>9.99 0
390 cveusuario inte m >>>9 0
400 cveforma inte >>>9 0
410 pais char x(17) MEXICO
420 saldopormoneda deci-2[25] ->>,>>>,>>9.99 0
430 cvecuentapormoneda inte[25] >>>>>>9 0
440 saldopapormoneda deci-2[25] ->>,>>>,>>9.99 0
450 extranjero logi i Si/No no
480 filial logi i Si/No no
490 prospecto logi i Si/No no
500 diasdevolucion inte >>>>>>9 0
510 local logi Si/No true
520 diasautodesactivar inte >>>>>9 0
530 numeroext char x(8)
540 numeroint char x(8)
550 foliocedula char x(10)
560 diasrevision inte >>>>>>>>>9 0
570 diaspago inte >>>>>>>>>9 0
600 requierepedido logi Si/No no
610 tipoimpuesto inte m >>>>>9 1
630 cvezonacobro inte >>>9 0
640 cvecobrador inte >>>9 0
650 horarevision char xx:xx - xx:xx
660 horapago char xx:xx - xx:xx
670 cvemediocliente inte >>>>9 0
680 freal date m 99/99/9999 TODAY
690 consignacion logi i Si/No no
700 cvealmacen inte >>>>>9 0
710 cveconsecutivo inte >>>>>9 0
720 nomfis char x(40)
730 apaterno char x(40)
740 amaterno char x(40)
750 facturarremisionar inte 9 0
760 consideraciones char x(15)
770 diasfijosrevision inte[5] >9 0
780 diasfijoscobro inte[5] >9 0
790 curp char x(18)
800 cveedi char x(30)
============================= INDEX SUMMARY =============================
============================= Table: cliente ============================
Flags: <p>rimary, <u>nique, <w>ord, <a>bbreviated, <i>nactive, + asc, - desc
Flags Index Name Cnt Field Name
----- -------------------------------- --- ---------------------------------
agecveclienterel 5 + cveempresa
+ prospecto
+ cveagente
+ cli_rel
+ cvecliente
agecveclienterelpro 5 + cveempresa
+ prospecto
+ cveagente
+ cli_rel
- cvecliente
agenombrerel 5 + cveempresa
+ prospecto
+ cveagente
+ cli_rel
+ nombre
agetiponombrerel 6 + cveempresa
+ prospecto
+ cveagente
+ cvetipocliente
+ cli_rel
+ nombre
clienterel 3 + cveempresa
+ cli_rel
+ cvecliente
cli_rel 2 + cveempresa
+ cli_rel
consignacion 4 + cveempresa
+ consignacion
+ cli_rel
+ nombre
w contenidonombre 1 + nombre
pu cvecliente 2 + cveempresa
+ cvecliente
cveclienterelpro 4 + cveempresa
+ prospecto
+ cli_rel
+ cvecliente
u cvecuenta 3 + cveempresa
+ cvecliente
+ cvecuenta
cvecuenta2 2 + cveempresa
+ cvecuenta
cveprospecto 4 + cveempresa
+ prospecto
+ cli_rel
- cvecliente
extranjero 2 + cveempresa
+ extranjero
factoraje 4 + cveempresa
+ factoraje
+ cli_rel
+ nombre
filial 2 + cveempresa
+ filial
nomabr 2 + cveempresa
+ nomabr
nombre 2 + cveempresa
+ nombre
nombrerel 4 + cveempresa
+ prospecto
+ cli_rel
+ nombre
u nombreunico 3 + cveempresa
+ cli_rel
+ nombre
a rfc 3 + cveempresa
+ cli_rel
+ rfc
saldo 3 + cveempresa
+ cli_rel
+ saldo
saldos 2 + cveempresa
+ saldo
tipocliente 2 + cveempresa
+ cvetipocliente
tiponombrerel 5 + cveempresa
+ prospecto
+ cvetipocliente
+ cli_rel
+ nombre
As you can see, there are five fields extend, three integer and two decimal and there are a unique primary composite key with cvecliente and cveempresa and several index more.
Right now, I have this in POJO:
/**
* @hibernate.array table="pub.Cliente"
* @hibernate.element column="diasfijoscobro" type="integer"
* @hibernate.key
* @hibernate.column="cvecliente"
* @hibernate.column="cveempresa"
* @hibernate.index column="cvecliente_index"
* @return
*/
and when I run unit test I get:
[junit] Testcase: testGetClientes(com.soficlassic.dao.ClienteDaoTest): Caused an ERROR
[junit] Error creating bean with name 'sessionFactory' defined in file [D:\Preproduccion\ExtranetSOFI\build\dao\gen\META-INF\applicationContext-hi
bernate.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Foreign key (FKCCCB93E9A969CFE8:pub.Cliente [id]))
must have same number of columns as the referenced primary key (pub.Cliente [id,cvecliente_index])
[junit] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\Preproduccion\
ExtranetSOFI\build\dao\gen\META-INF\applicationContext-hibernate.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingExce
ption: Foreign key (FKCCCB93E9A969CFE8:pub.Cliente [id])) must have same number of columns as the referenced primary key (pub.Cliente [id,cvecliente_i
ndex])
[junit] Caused by: org.hibernate.MappingException: Foreign key (FKCCCB93E9A969CFE8:pub.Cliente [id])) must have same number of columns as the refe
renced primary key (pub.Cliente [id,cvecliente_index])
[junit] at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:90)
[junit] at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:73)
[junit] at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1187)
[junit] at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1094)
[junit] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1210)
[junit] at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:807)
[junit] at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:740)
[junit] at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:131)
[junit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.j
ava:1062)
[junit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java
:1029)
[junit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:420
)
[junit] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
[junit] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
[junit] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
[junit] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)
[junit] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
[junit] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:348)
[junit] at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:92)
[junit] at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:77)
[junit] at org.springframework.test.AbstractSingleSpringContextTests.loadContextLocations(AbstractSingleSpringContextTests.java:138)
[junit] at org.springframework.test.AbstractSingleSpringContextTests.loadContext(AbstractSingleSpringContextTests.java:125)
[junit] at org.springframework.test.AbstractSpringContextTests.getContext(AbstractSpringContextTests.java:104)
[junit] at org.springframework.test.AbstractSingleSpringContextTests.setUp(AbstractSingleSpringContextTests.java:75)
[junit] at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
[junit]
[junit]
[junit] Test com.soficlassic.dao.ClienteDaoTest FAILED
Upsss, it's too much data, but I hope you can help and sorry but my english.
Thanks,
Gore
|