Hibernate annotations ou .hbm.xml?

4 respostas
E

Queria saber o q é melhor, hibernate annotations ou o hbm.xml ou xdoclet.

é melhor criar a configuração assim :
private static SessionFactory factory;

static {
	AnnotationConfiguration cfg = new AnnotationConfiguration();
	cfg.addAnnotatedClass(Tabela1.class);
            cfg.addAnnotatedClass(Tabela2.class);
	factory = cfg.buildSessionFactory();
}

ou

mapear td nos xml’s ???

4 Respostas

C

annotations + hibernate.cfg.xml

E

estou começando achar isso tb.
eu não usei o cfg.xml, fiz td no annotatedClass(tablea.class…
mas se tiver muitas tabelas melhor é fazer no cfg.xml né.
tb, qq mudança não preciso recompilar o código.
eu tinha pego um tutorial da Caelum q não ensina com o cfg.

robson_vs

Cara ñ tem o melhor, melhor é aquele q vc faz e sente mais confiança e q vc acha q te dá mais produtividade.

Mais eu em particular acho q annotations é muito melhor de q qualquer xml e é totalmente java.

I

Eu particularmente uso hbm.xml =)…

Criado 17 de agosto de 2006
Ultima resposta 17 de ago. de 2006
Respostas 4
Participantes 4