ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From José María Ruiz <josema...@simpleoption.com>
Subject Re: A problem with iBatis3
Date Tue, 11 May 2010 15:56:04 GMT

Yes, it's the constructor. If I comment it all goes fine.

But I need this constructor to inject dependencies... what can I do?


José María Ruiz wrote:
> 
> 
> I've my own constructor (it doesn't appear in the code I pasted sorry):
> 
> 
> public Marca() {
>     	InjectorHolder.getInjector().inject(this);
> }
> 
> 
> InjectorHolder is part of Wicket, it worked well with iBatis2 :-m
> 
> Cheers.
> 
> 
> 
> Clinton Begin wrote:
>> 
>> What kind of constructor does lombok result in?  It looks to me like
>> the constructor is either generated as private or with parameters.
>> 
>> Clinton
>> 
>> 2010/5/11 José María Ruiz <josemaria@simpleoption.com>:
>>>
>>> Hi.
>>>
>>> First, thanks for you effort with iBatis. I think it's a wonderful "orm"
>>> for
>>> all of us who don't hate sql ;).
>>>
>>> Now my problem.
>>>
>>> I've a web app working with iBatis2. All was fine, but I just wanted to
>>> use
>>> the new iBatis3.
>>>
>>> After some knowledge and word mapping between the two versions I get it
>>> working more or less until I tried my first <select>, and I got:
>>>
>>> 11:16:27.893 [main] DEBUG o.a.i.d.pooled.PooledDataSource -
>>> PooledDataSource
>>> forcefully closed/removed all connections.
>>> 11:16:27.899 [main] DEBUG o.a.i.d.pooled.PooledDataSource -
>>> PooledDataSource
>>> forcefully closed/removed all connections.
>>> 11:16:27.899 [main] DEBUG o.a.i.d.pooled.PooledDataSource -
>>> PooledDataSource
>>> forcefully closed/removed all connections.
>>> 11:16:27.899 [main] DEBUG o.a.i.d.pooled.PooledDataSource -
>>> PooledDataSource
>>> forcefully closed/removed all connections.
>>> 11:16:28.186 [main] DEBUG o.a.i.d.pooled.PooledDataSource - Created
>>> connection 14871751.
>>> 11:16:28.189 [main] DEBUG java.sql.Connection - ooo Connection Opened
>>> ID de la marca: 162
>>> 11:16:28.295 [main] DEBUG java.sql.PreparedStatement - ==>  Executing:
>>> SELECT id, nombre FROM marcas WHERE id = ?
>>> 11:16:28.296 [main] DEBUG java.sql.PreparedStatement - ==> Parameters:
>>> 162(Integer)
>>> 11:16:28.339 [main] DEBUG java.sql.ResultSet - <==    Columns: id,
>>> nombre
>>> 11:16:28.339 [main] DEBUG java.sql.ResultSet - <==        Row: 162,
>>> GIANTmicrobes
>>> 11-may-2010 11:16:28
>>> com.simpleoption.eureka.ibatis.marca.MarcaRepository
>>> getById
>>> GRAVE: Que leches pasa:org.apache.ibatis.exceptions.IbatisException:
>>> ### Error querying database.  Cause:
>>> org.apache.ibatis.reflection.ReflectionException: Error instantiating
>>> class
>>> com.simpleoption.eureka.repositorios.marca.Marca with invalid types ()
>>> or
>>> values (). Cause: java.lang.reflect.InvocationTargetException
>>> ### The error may involve marca.getById-Inline
>>> ### The error occurred while setting parameters
>>> ### Cause: org.apache.ibatis.reflection.ReflectionException: Error
>>> instantiating class com.simpleoption.eureka.repositorios.marca.Marca
>>> with
>>> invalid types () or values (). Cause:
>>> java.lang.reflect.InvocationTargetException
>>> 11:16:28.363 [main] DEBUG java.sql.Connection - xxx Connection Closed
>>> 11:16:28.363 [main] DEBUG o.a.i.d.pooled.PooledDataSource - Returned
>>> connection 14871751 to pool.
>>>
>>> I don't understand the error, what is this "Error instantiating class
>>> com.simpleoption.eureka.repositorios.marca.Marca with invalid types ()
>>> or
>>> values ()"? where should I look?
>>>
>>> I thougth it was a problem with mapping in the file "Marca.xml" but it
>>> looks
>>> fine:
>>>
>>>
>>> <resultMap id="marcaResult" type="Marca">
>>> <result property="id" column="id" javaType="Integer"/>
>>> <result property="nombre" column="nombre" javaType="String"/>
>>> </resultMap>
>>> <select id="getById" resultMap="marcaResult" parameterType="Integer">
>>>        SELECT id, nombre
>>>        FROM marcas
>>>        WHERE id = #{id}
>>> </select>
>>>
>>>
>>> The file Marca.java is (yes, I'm using lombok, but it works):
>>>
>>> @EqualsAndHashCode(of="id", callSuper=false)
>>> public class Marca extends Entidad<Integer>  implements Serializable {
>>>
>>>    private static final long serialVersionUID = -7672146657644908136L;
>>>
>>>    @Getter @Setter private Integer id;
>>>    @Getter @Setter private String nombre;
>>> }
>>>
>>> Simple, isn't it? I can select the table without problems through the
>>> psql
>>> command of postgresql.
>>>
>>>
>>> Cheers.
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/A-problem-with-iBatis3-tp28525309p28525309.html
>>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>>
>>>
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/A-problem-with-iBatis3-tp28525309p28525960.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message