-
1. Re: Property in entity not part of db table
tekchandp Jun 24, 2009 8:21 PM (in response to daxxy)try with this .. put this method in ur entity
public boolean getRender(){ int render = false; if(stackMember.equals(devIp)){ render = true; } return render; } <h:outputText rendered="#{devices.render}" value="#{devices.devIp}" />
-
2. Re: Property in entity not part of db table
daxxy Jun 25, 2009 4:04 PM (in response to daxxy)I should have mentioned in my original posting what I've already tried.
I did try this (though I call my boolean stackMember) and get an error. Here is the code and the error follows:
public boolean isStackMember() { stackMember = false; if (devIp.startsWith("Stack")) stackMember = true; else stackMember = false; return stackMember; }
Caused by: com.mysql.jdbc.exceptions. jdbc4.MySQLSyntaxErrorException: Unknown column 'devices0_.stackMember' in 'field list'
It's not in the field list because it's not in the database. But it's in the entity. How do I tell the app that even though it's in the entity, it should be part of the query because it is NOT in the database?
-
3. Re: Property in entity not part of db table
wachtda.scsi.gmx.ch Jun 25, 2009 4:19 PM (in response to daxxy)This should work with @Transient!
Maybe it would be better to give your method another name which normaly not is used as getter/setter. (z.B. gotStackMember())? -
4. Re: Property in entity not part of db table
daxxy Jun 29, 2009 8:40 PM (in response to daxxy)Here is what finally worked. The thing that made the difference was renaming the getter. Here is the code:
in Devices.java:
@Transient private boolean stackMember;
...
public boolean gotStackMember() { stackMember = false; if (devIp.startsWith("Stack")) stackMember = true; else stackMember = false; return stackMember; } public void setStackMember(boolean stackMember) { this.stackMember = stackMember; }
in view:
<h:outputLink rendered="#{not _device.gotStackMember()}" value="#{interpolator.interpolate(messages['ond.label.url.telnetdevip'], _device.devIp)}"> <h:outputText value="#{_device.devIp}" /> </h:outputLink> <h:outputText value="#{_device.devIp}" rendered="#{_device.gotStackMember()}" />
Thanks for the feedback!
TDR