-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate doesn't find getter
PostPosted: Mon Aug 15, 2005 11:02 am 
Newbie

Joined: Sat Jul 23, 2005 7:19 pm
Posts: 11
I don't know if this is a bug or just I didn't realize something. I had problems with getters.
I first create fields on my entity class, then I order NetBeans to refactor it adding getter and setter methods.
Well, Hibernate didn't recognize my getter methods for: "aCargo" (a boolean) and "eMail" (a String). I realized that I had to rename aCargo as acargo and eMail as email, because it didn't work when field started with lower case and then capital letter.
Isn't that a bug?


Hibernate version:
3.0
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class name="com.neaprog.geriatrico.datos.Familiar"
table="FAMILIARES">
<id name="idFamiliar" column="idFamiliar">
<generator class="increment"/>
</id>
<property name="apellidos" type="string" column="apelidos"/>
<property name="nombres" type="string" column="nombres"/>
<property name="parentesco" type="string" column="parentesco"/>
<property name="aCargo" type="boolean" column="acargo"/>
<property name="direccion" type="string" column="direccion"/>
<property name="otraDireccion" type="string" column="otradireccion"/>
<property name="telefono" type="string" column="telefono"/>
<property name="movil" type="string" column="movil"/>
<property name="telefonoTrabajo" type="string" column="telefonotrabajo"/>
<property name="eMail" type="string" column="email"/>
<property name="tipoDoc" type="string" column="tipoDoc"/>
<property name="numeroDoc" type="string" column="numeroDoc"/>
<property name="sexo" type="boolean" column="sexo"/>
</class>
</hibernate-mapping>

Full stack trace of any exception that occurs:
0 [AWT-EventQueue-0] INFO cfg.Environment - Hibernate 3.0.5
16 [AWT-EventQueue-0] INFO cfg.Environment - hibernate.properties not found
31 [AWT-EventQueue-0] INFO cfg.Environment - using CGLIB reflection optimizer
78 [AWT-EventQueue-0] INFO cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
219 [AWT-EventQueue-0] INFO cfg.Configuration - configuring from resource: hibernate.cfg.xml
219 [AWT-EventQueue-0] INFO cfg.Configuration - Configuration resource: hibernate.cfg.xml
1156 [AWT-EventQueue-0] INFO cfg.Configuration - Configured SessionFactory: null
1203 [AWT-EventQueue-0] INFO cfg.Configuration - Mapping resource: com/neaprog/geriatrico/datos/Internado.hbm.xml
1516 [AWT-EventQueue-0] INFO cfg.HbmBinder - Mapping class: com.neaprog.geriatrico.datos.Internado -> INTERNADOS
1937 [AWT-EventQueue-0] INFO cfg.HbmBinder - Mapping collection: com.neaprog.geriatrico.datos.Internado.familiares -> INTERNADOS_FAMILIARES
1937 [AWT-EventQueue-0] INFO cfg.Configuration - Mapping resource: com/neaprog/geriatrico/datos/ObraSocial.hbm.xml
2000 [AWT-EventQueue-0] INFO cfg.HbmBinder - Mapping class: com.neaprog.geriatrico.datos.ObraSocial -> OBRAS_SOCIALES
2000 [AWT-EventQueue-0] INFO cfg.Configuration - Mapping resource: com/neaprog/geriatrico/datos/Familiar.hbm.xml
2219 [AWT-EventQueue-0] INFO cfg.HbmBinder - Mapping class: com.neaprog.geriatrico.datos.Familiar -> FAMILIARES
2234 [AWT-EventQueue-0] INFO cfg.Configuration - processing extends queue
2234 [AWT-EventQueue-0] INFO cfg.Configuration - processing collection mappings
2250 [AWT-EventQueue-0] INFO cfg.Configuration - processing association property references
2250 [AWT-EventQueue-0] INFO cfg.Configuration - processing foreign key constraints
2281 [AWT-EventQueue-0] INFO connection.C3P0ConnectionProvider - C3P0 using driver: net.sourceforge.jtds.jdbc.Driver at URL: jdbc:jtds:sqlserver://federico:1991/geriatrico
2281 [AWT-EventQueue-0] INFO connection.C3P0ConnectionProvider - Connection properties: {user=redondex, password=****}
2281 [AWT-EventQueue-0] INFO connection.C3P0ConnectionProvider - autocommit mode: false
Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@10da5eb [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@d1fa5 [ acquireIncrement -> 1, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, idleConnectionTestPeriod -> 3000, initialPoolSize -> 5, maxIdleTime -> 100, maxPoolSize -> 50, maxStatements -> 50, maxStatementsPerConnection -> 0, minPoolSize -> 5, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@b0bad7 [ description -> null, driverClass -> null, factoryClassLocation -> null, jdbcUrl -> jdbc:jtds:sqlserver://federico:1991/geriatrico, properties -> {user=******, password=******} ] , preferredTestQuery -> null, propertyCycle -> 300, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, usesTraditionalReflectiveProxies -> false ] , factoryClassLocation -> null, numHelperThreads -> 3, poolOwnerIdentityToken -> 10da5eb ]
4828 [AWT-EventQueue-0] INFO cfg.SettingsFactory - RDBMS: Microsoft SQL Server, version: 08.00.0194
4828 [AWT-EventQueue-0] INFO cfg.SettingsFactory - JDBC driver: jTDS Type 4 JDBC Driver for MS SQL Server and Sybase, version: 1.1
4937 [AWT-EventQueue-0] INFO dialect.Dialect - Using dialect: org.hibernate.dialect.HSQLDialect
4969 [AWT-EventQueue-0] INFO transaction.TransactionFactoryFactory - Using default transaction strategy (direct JDBC transactions)
4969 [AWT-EventQueue-0] INFO transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
4969 [AWT-EventQueue-0] INFO cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
4969 [AWT-EventQueue-0] INFO cfg.SettingsFactory - Automatic session close at end of transaction: disabled
4969 [AWT-EventQueue-0] INFO cfg.SettingsFactory - JDBC batch size: 15
4969 [AWT-EventQueue-0] INFO cfg.SettingsFactory - JDBC batch updates for versioned data: disabled
4984 [AWT-EventQueue-0] INFO cfg.SettingsFactory - Scrollable result sets: enabled
4984 [AWT-EventQueue-0] INFO cfg.SettingsFactory - JDBC3 getGeneratedKeys(): enabled
4984 [AWT-EventQueue-0] INFO cfg.SettingsFactory - Connection release mode: null
4984 [AWT-EventQueue-0] INFO cfg.SettingsFactory - Default batch fetch size: 1
4984 [AWT-EventQueue-0] INFO cfg.SettingsFactory - Generate SQL with comments: disabled
4984 [AWT-EventQueue-0] INFO cfg.SettingsFactory - Order SQL updates by primary key: disabled
4984 [AWT-EventQueue-0] INFO cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
5016 [AWT-EventQueue-0] INFO ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
5016 [AWT-EventQueue-0] INFO cfg.SettingsFactory - Query language substitutions: {true=1, either=2, false=0}
5016 [AWT-EventQueue-0] INFO cfg.SettingsFactory - Second-level cache: enabled
5016 [AWT-EventQueue-0] INFO cfg.SettingsFactory - Query cache: disabled
5016 [AWT-EventQueue-0] INFO cfg.SettingsFactory - Cache provider: org.hibernate.cache.EhCacheProvider
5047 [AWT-EventQueue-0] INFO cfg.SettingsFactory - Optimize cache for minimal puts: disabled
5047 [AWT-EventQueue-0] INFO cfg.SettingsFactory - Structured second-level cache entries: disabled
5094 [AWT-EventQueue-0] INFO cfg.SettingsFactory - Echoing all SQL to stdout
5094 [AWT-EventQueue-0] INFO cfg.SettingsFactory - Statistics: disabled
5094 [AWT-EventQueue-0] INFO cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
5094 [AWT-EventQueue-0] INFO cfg.SettingsFactory - Default entity-mode: pojo
5391 [AWT-EventQueue-0] INFO impl.SessionFactoryImpl - building session factory
5453 [AWT-EventQueue-0] WARN config.Configurator - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/D:/Archivos%20de%20programa/Java/hibernate-3.0/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
Initial SessionFactory creation failed.org.hibernate.PropertyNotFoundException: Could not find a getter for aCargo in class com.neaprog.geriatrico.datos.Familiar
Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
Name and version of the database you are using:
SQLServer 2000


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 15, 2005 11:06 am 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
You need to post your java code.

But if you have an attribute foo you need to have

getFoo() and setFoo(Foo foo)

as your getters and setters. It's nothing to do with captials, it's the prefix.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 15, 2005 12:01 pm 
Beginner
Beginner

Joined: Tue Apr 05, 2005 4:27 pm
Posts: 40
Location: canada
i think this explains your problem...

http://forum.hibernate.org/viewtopic.php?t=932841

http://www.hibernate.org/116.html#A31

if your getter looks like getEMail() then you should define your property as <property name="EMail" type="string" column="email"/>


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

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.