Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
Michael Schulz
column name service.xml
24 de mayo de 2012 6:43
Respuesta

Michael Schulz

Ranking: Junior Member

Mensajes: 27

Fecha de incorporación: 8 de marzo de 2012

Mensajes recientes

Hello,

i'm using <column name="E-mail" type="String" /> in service.xml but build services throws parser exception because of "-".
is there a way to escape the hyphen?

Thank you for your time and hints!
David H Nebinger
RE: column name service.xml
24 de mayo de 2012 10:19
Respuesta

David H Nebinger

Community Moderator

Ranking: Liferay Legend

Mensajes: 11770

Fecha de incorporación: 1 de septiembre de 2006

Mensajes recientes

No, cuz it would want to create a java class w/ name "e-mail" w/ getters/setters as getE-mail() and setE-mail(), all of which are bad names.

Don't try to be fancy in your database design, just stick w/ simple names and just do the "E-mail" thing in the display.
Michael Schulz
RE: column name service.xml
24 de mayo de 2012 13:58
Respuesta

Michael Schulz

Ranking: Junior Member

Mensajes: 27

Fecha de incorporación: 8 de marzo de 2012

Mensajes recientes

Thank you very much for your answer!
i can't build a service to get data from a database-table with a column named "E-mail"?
i'm not trying to implement getters and setters getE-mail() and setE-mail(), it's the service builder;)

please let me know if there are any solutions using the service builder and column name E-mail,

Thank You!
David H Nebinger
RE: column name service.xml
24 de mayo de 2012 15:00
Respuesta

David H Nebinger

Community Moderator

Ranking: Liferay Legend

Mensajes: 11770

Fecha de incorporación: 1 de septiembre de 2006

Mensajes recientes

yes, but you must specify it in the "db-name" attribute, your column name cannot contain the dash.
Michael Schulz
RE: column name service.xml
25 de mayo de 2012 11:02
Respuesta

Michael Schulz

Ranking: Junior Member

Mensajes: 27

Fecha de incorporación: 8 de marzo de 2012

Mensajes recientes

Thanks again, this did it!

first i got exceptions using db-name="E-mail" then i used db-name="`E-mail`" and now it works.
unfortunately i can't find the link for using the backtick in hibernate anymore but if i remember correct it makes hibernate generate the correct sql-syntax for the used hibernate.dialect (f.e. using [E-mail] would make problems with some dialects!?)
edit: link

for the E-mail column in sqlserver-dialect it works, thank you