Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
Articles
Articles_pt
CreateManager_pt
LeftMenu




JSPWiki v2.2.33

[RSS]


Hide Menu

CreateDAO_pt


Difference between version 11 and version 10:

At line 50 changed 1 line.
No fragmento de código acima, nós estamos extendendo [BaseObject|http://raibledesigns.com/downloads/appfuse/api/org/appfuse/model/BaseObject.java.html] porque ele contem os seguintes métodos úteis: toString(), equals(), hashCode() - os dois últimos são requeridos pelo Hibernate.
No fragmento de código acima, nós estamos extendendo [BaseObject|http://raibledesigns.com/downloads/appfuse/api/org/appfuse/model/BaseObject.java.html] porque ela contem os seguintes métodos úteis: toString(), equals(), hashCode() - os dois últimos são requeridos pelo Hibernate.
At line 80 changed 1 line.
;:%%(color: blue)''I'm using {{generator-class="increment"}} instead of {{generate-class="native"}} because I [found some issues|AppFuseOnDB2] when using "native" on other databases. If you only plan on using MySQL, I recommend you use the "native" value.''%%
;:%%(color: blue)''Estou usando {{generator-class="increment"}} ao invés de {{generate-class="native"}} porque [encontrei alguns problemas|AppFuseOnDB2] ao usar “native” em outros bancos de dados. Se você somente planeja usar o MySql, eu recomendo que você use o valor “native”.''%%
At line 82 changed 2 lines.
!!Create a new database table from the object using Ant [#2]
At this point, you can actually create the person table by running "ant setup-db". This task creates the Person.hbm.xml file and creates a database table called "person." From the ant console, you can see the table schema the Hibernate creates for your:
!!Criar uma nova tabela no banco de dados a partir do objeto, usando Ant [#2]
Neste ponto, você pode atualmente criar a tabela pessoa executando “ant setup-db”. Esta tarefa cria o arquivo Pessoa.hbm.xml e cria uma tabela no banco de dados chamada “pessoa”. A partir do console ant, você pode ver o schema da tabela que Hibernate cria para você:
At line 91 changed 1 line.
If you want to look at the Person.hbm.xml file that Hibernate generates for you, look in the build/dao/gen/**/hibernate directory. Here's the contents of Person.hbm.xml (so far):
Se você quiser procurar o arquivo Pessoa.hbm.xml que Hibernate gera para você, procure no diretório build/dao/gen/**/hibernate. Aqui está o conteúdo do Pessoa.hbm.xml (até aqui):
At line 130 changed 1 line.
Now we'll add additional [@hibernate.property|http://xdoclet.sourceforge.net/tags/hibernate-tags.html#@hibernate.property%20(0..1)] tags for our other columns (first_name, last_name):
Agora nós iremos adicionar tags [@hibernate.property|http://xdoclet.sourceforge.net/tags/hibernate-tags.html#@hibernate.property%20(0..1)] para nossas colunas (primeiroNome, ultimoNome):
At line 151 changed 1 line.
In this example, the only reason for adding the ''column'' attribute is because the column name is different from our property name. If they're the same, you don't need to specify the ''column'' attribute. See the [@hibernate.property|http://xdoclet.sourceforge.net/tags/hibernate-tags.html#@hibernate.property%20(0..1)] reference for other attributes you can specify for this tag.
Neste exemplo, a única razão de adicionar o atributo column é porque o nome da coluna é diferente do nome da propriedade. Se elas forem iguais, você não necessita especificar o atributo column. Veja a referência [@hibernate.property|http://xdoclet.sourceforge.net/tags/hibernate-tags.html#@hibernate.property%20(0..1)] para outros atributos que você pode especificar para este tag.
At line 153 changed 1 line.
Run "ant setup-db" again to get the additional columns added to your table.
Execute “ant setup-db” outra vez para ter as colunas adicionais adicionadas à sua tabela.

Back to CreateDAO_pt, or to the Page History.