bonjour tout le monde j ai un problem a mapper une inner classe.
voici mon pojo
Code:
package pojo;
import java.io.Serializable;
public class FinancementPojo implements Serializable, InterfacePojo {
[b]public static class IdFinancement implements Serializable {
private static final long serialVersionUID = 7471694153145514198L;
private String finControlNumber;
private String finType;
private String finPolicy;
private String finControlClaimDesc;
public IdFinancement(String finControlNumber, String finType, String finPolicy, String finControlClaimDesc) {
this.finControlNumber = finControlNumber;
this.finType = finType;
this.finPolicy = finPolicy;
this.finControlClaimDesc = finControlClaimDesc;
}
public IdFinancement() {
}
public String getFinControlClaimDesc() {
return finControlClaimDesc;
}
public void setFinControlClaimDesc(String finControlClaimDesc) {
this.finControlClaimDesc = finControlClaimDesc;
}
public String getFinControlNumber() {
return finControlNumber;
}
public void setFinControlNumber(String finControlNumber) {
this.finControlNumber = finControlNumber;
}
public String getFinPolicy() {
return finPolicy;
}
public void setFinPolicy(String finPolicy) {
this.finPolicy = finPolicy;
}
public String getFinType() {
return finType;
}
public void setFinType(String finType) {
this.finType = finType;
}
@Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
result = PRIME * result + ((finControlClaimDesc == null) ? 0 : finControlClaimDesc.hashCode());
result = PRIME * result + ((finControlNumber == null) ? 0 : finControlNumber.hashCode());
result = PRIME * result + ((finPolicy == null) ? 0 : finPolicy.hashCode());
result = PRIME * result + ((finType == null) ? 0 : finType.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final IdFinancement other = (IdFinancement) obj;
if (finControlClaimDesc == null) {
if (other.finControlClaimDesc != null)
return false;
} else if (!finControlClaimDesc.equals(other.finControlClaimDesc))
return false;
if (finControlNumber == null) {
if (other.finControlNumber != null)
return false;
} else if (!finControlNumber.equals(other.finControlNumber))
return false;
if (finPolicy == null) {
if (other.finPolicy != null)
return false;
} else if (!finPolicy.equals(other.finPolicy))
return false;
if (finType == null) {
if (other.finType != null)
return false;
} else if (!finType.equals(other.finType))
return false;
return true;
}
}[/b]
private static final long serialVersionUID = -4193363182767915742L;
private IdFinancement id;
private String finPolicy;
private String finControlNumber;
private String finControlClaimDesc;
private String finType;
private Integer finNbrLignes;
private Integer finNbrJoursh;
private Integer finNbrJoursm;
/* [CONSTRUCTOR MARKER BEGIN] */
public FinancementPojo() {
super();
}
/**
* Constructor for primary key
*/
public FinancementPojo(String finPolicy,
String finControlNumber,
String finControlClaimDesc, String finType) {
this.finPolicy = finPolicy;
this.finControlNumber = finControlNumber;
this.finControlClaimDesc = finControlClaimDesc;
this.finType = finType;
}
/**
* Constructor for required fields
*/
public FinancementPojo(String finPolicy,
String finControlNumber,
String finControlClaimDesc, String finType,
Integer finNbrLignes, Integer finNbrJoursh,
Integer finNbrJoursm) {
this.finPolicy = finPolicy;
this.finControlNumber = finControlNumber;
this.finControlClaimDesc = finControlClaimDesc;
this.finType = finType;
this.finNbrLignes = finNbrLignes;
this.finNbrJoursh = finNbrJoursh;
this.finNbrJoursm = finNbrJoursm;
}
/**
* @return finControlClaimDesc
*/
public String getFinControlClaimDesc() {
return finControlClaimDesc;
}
/**
* @param finControlClaimDesc
* finControlClaimDesc à définir
*/
public void setFinControlClaimDesc(String finControlClaimDesc) {
this.finControlClaimDesc = finControlClaimDesc;
}
/**
* @return finControlNumber
*/
public String getFinControlNumber() {
return finControlNumber;
}
/**
* @param finControlNumber
* finControlNumber à définir
*/
public void setFinControlNumber(String finControlNumber) {
this.finControlNumber = finControlNumber;
}
/**
* @return finNbrJoursh
*/
public Integer getFinNbrJoursh() {
return finNbrJoursh;
}
/**
* @param finNbrJoursh
* finNbrJoursh à définir
*/
public void setFinNbrJoursh(Integer finNbrJoursh) {
this.finNbrJoursh = finNbrJoursh;
}
/**
* @return finNbrJoursm
*/
public Integer getFinNbrJoursm() {
return finNbrJoursm;
}
/**
* @param finNbrJoursm
* finNbrJoursm à définir
*/
public void setFinNbrJoursm(Integer finNbrJoursm) {
this.finNbrJoursm = finNbrJoursm;
}
/**
* @return finNbrLignes
*/
public Integer getFinNbrLignes() {
return finNbrLignes;
}
/**
* @param finNbrLignes
* finNbrLignes à définir
*/
public void setFinNbrLignes(Integer finNbrLignes) {
this.finNbrLignes = finNbrLignes;
}
/**
* @return finPolicy
*/
public String getFinPolicy() {
return finPolicy;
}
/**
* @param finPolicy
* finPolicy à définir
*/
public void setFinPolicy(String finPolicy) {
this.finPolicy = finPolicy;
}
/**
* @return finType
*/
public String getFinType() {
return finType;
}
/**
* @param finType
* finType à définir
*/
public void setFinType(String finType) {
this.finType = finType;
}
public InterfacePojo getID() {
// TODO Raccord de méthode auto-généré
return null;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
result = PRIME
* result
+ ((finControlClaimDesc == null) ? 0 : finControlClaimDesc
.hashCode());
result = PRIME
* result
+ ((finControlNumber == null) ? 0 : finControlNumber.hashCode());
result = PRIME * result
+ ((finPolicy == null) ? 0 : finPolicy.hashCode());
result = PRIME * result + ((finType == null) ? 0 : finType.hashCode());
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final FinancementPojo other = (FinancementPojo) obj;
if (finControlClaimDesc == null) {
if (other.finControlClaimDesc != null)
return false;
} else if (!finControlClaimDesc.equals(other.finControlClaimDesc))
return false;
if (finControlNumber == null) {
if (other.finControlNumber != null)
return false;
} else if (!finControlNumber.equals(other.finControlNumber))
return false;
if (finPolicy == null) {
if (other.finPolicy != null)
return false;
} else if (!finPolicy.equals(other.finPolicy))
return false;
if (finType == null) {
if (other.finType != null)
return false;
} else if (!finType.equals(other.finType))
return false;
return true;
}
public IdFinancement getId() {
return id;
}
public void setId() {
IdFinancement id =new IdFinancement(finControlNumber,finType,finPolicy,finControlClaimDesc);
this.setId(id);
}
public void setId(IdFinancement id) {
this.id = id;
}
}
mon hbm
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping package="pojo">
<class
name="FinancementPojo"
table="FINANCEMENT"
>
[b]<composite-id name="id" class="pojo.FinancementPojo$IdFinancement">
<key-property
name="finControlNumber"
column="FIN_CONTROL_NUMBER"
type="string"
length="10"
/>
<key-property
name="finType"
column="FIN_TYPE"
type="string"
length="2"
/>
<key-property
name="finPolicy"
column="FIN_POLICY"
type="string"
length="10"
/>
<key-property
name="finControlClaimDesc"
column="FIN_CONTROL_CLAIM_DESC"
type="string"
length="2"
/>
</composite-id>[/b]
<property
name="finNbrJoursh"
column="FIN_NBR_JOURSH"
type="integer"
not-null="true"
length="5"
/>
<property
name="finNbrLignes"
column="FIN_NBR_LIGNES"
type="integer"
not-null="true"
length="5"
/>
<property
name="finNbrJoursm"
column="FIN_NBR_JOURSM"
type="integer"
not-null="true"
length="5"
/>
</class>
</hibernate-mapping>
et pour finir l erreur dans la console
Quote:
18:28:52,165 ERROR ServiceException:16 - Unknown entity: pojo.FinancementPojo$IdFinancement
org.hibernate.MappingException: Unknown entity: pojo.FinancementPojo$IdFinancement
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:580)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:91)
at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:905)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:842)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:835)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:342)
at $Proxy0.get(Unknown Source)
at ca.canassistance.dao.BaseRootDAO.get(BaseRootDAO.java:219)
at ca.canassistance.service.PPO_NTrairePersistance.existFinancement(PPO_NTrairePersistance.java:443)
at ca.canassistance.batch.MettreaJourXc4dsavXc4dtavPpo210.verifierFinancementExistFinancement(MettreaJourXc4dsavXc4dtavPpo210.java:407)
at ca.canassistance.batch.MettreaJourXc4dsavXc4dtavPpo210.validerEtatFinancement(MettreaJourXc4dsavXc4dtavPpo210.java:384)
at ca.canassistance.batch.MettreaJourXc4dsavXc4dtavPpo210.verifierSiVersionPlusRecente(MettreaJourXc4dsavXc4dtavPpo210.java:358)
at ca.canassistance.batch.MettreaJourXc4dsavXc4dtavPpo210.finaliserTraitementPrecedent(MettreaJourXc4dsavXc4dtavPpo210.java:346)
at ca.canassistance.batch.MettreaJourXc4dsavXc4dtavPpo210.<init>(MettreaJourXc4dsavXc4dtavPpo210.java:277)
at ca.canassistance.batch.MettreaJourXc4dsavXc4dtavPpo210.main(MettreaJourXc4dsavXc4dtavPpo210.java:540)
est ce qu il y aurait une personne pour me dire
qu est ce que je fais de mal merci