Foros de discusión

column name service.xml

Michael Schulz, modificado hace 11 años.

column name service.xml

Junior Member Mensajes: 26 Fecha de incorporación: 8/03/12 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!
thumbnail
David H Nebinger, modificado hace 11 años.

RE: column name service.xml

Liferay Legend Mensajes: 14915 Fecha de incorporación: 2/09/06 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, modificado hace 11 años.

RE: column name service.xml

Junior Member Mensajes: 26 Fecha de incorporación: 8/03/12 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!
thumbnail
David H Nebinger, modificado hace 11 años.

RE: column name service.xml (Respuesta)

Liferay Legend Mensajes: 14915 Fecha de incorporación: 2/09/06 Mensajes recientes
yes, but you must specify it in the "db-name" attribute, your column name cannot contain the dash.
Michael Schulz, modificado hace 11 años.

RE: column name service.xml

Junior Member Mensajes: 26 Fecha de incorporación: 8/03/12 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