Using hibernate with class:
Text.java
package br.com.meusite.model.documento;
@Entity
public class Texto extends ABeanDao<Texto> {
private static final long serialVersionUID = 1L;
private static final int cMaxTamanhoIndice = 2712;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idTexto;
@Column(nullable = false, columnDefinition = "Text")
private String textoBruto;
@Column(nullable = false, columnDefinition = "Text")
private String idAlternativo;
@ManyToOne
@JoinColumn(name = "idTextoAnteriorParteDoTexto", nullable = true)
@ForeignKey(name = "fk_texto_textoAnteriorParteDoTexto")
private Texto textoAnteriorParteDoTexto;
public Texto(){}
//getters and setters
}
When I make a query with like in the bank through hibernate I return the following message at the end of the query:
DEBUG ResultSetProcessorImpl:127 - Starting ResultSet row #0
DEBUG EntityReferenceInitializerImpl:142 - On call to EntityIdentifierReaderImpl#resolve, EntityKey was already known; should only happen on root returns with an optional identifier specified
DEBUG TwoPhaseLoad:160 - Resolving associations for [br.com.meusite.model.documento.Texto#265752]
DEBUG TwoPhaseLoad:286 - Done materializing entity [br.com.meusite.model.documento.Texto#265752]
DEBUG TwoPhaseLoad:160 - Resolving associations for [br.com.meusite.model.documento.Texto#265751]
Follow the query as well.
select *
from
Texto texto0_
left outer join
Texto texto18_
on texto0_.idTextoAnteriorParteDoTexto=texto18_.idTexto
where
texto0_.idTexto=?
But I would have to generate a query LIKE
(texto0_.idAlternativo like?) and not texto0_.idTexto =?
What is the possible solution to the problem?