blob: b38636ac9db8dd544e5c74bd18220208a47b89d6 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_65) on Mon Jun 01 22:44:03 CEST 2015 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
BooleanRepresentation (OpenJPA Parent POM 2.4.0 API)
</TITLE>
<META NAME="date" CONTENT="2015-06-01">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="BooleanRepresentation (OpenJPA Parent POM 2.4.0 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/BooleanRepresentation.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../org/apache/openjpa/jdbc/sql/AccessDictionary.html" title="class in org.apache.openjpa.jdbc.sql"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../../org/apache/openjpa/jdbc/sql/BooleanRepresentationFactory.html" title="class in org.apache.openjpa.jdbc.sql"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/apache/openjpa/jdbc/sql/BooleanRepresentation.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="BooleanRepresentation.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.openjpa.jdbc.sql</FONT>
<BR>
Interface BooleanRepresentation&lt;REPRESENTATION_TYPE&gt;</H2>
<DL>
<DT><DT><B>Type Parameters:</B><DD><CODE>REPRESENTATION_TYPE</CODE> - the java type which is used to store the Boolean in the database,
e.g. <code>String</code> or <code>Integer</code></DL>
<DL>
<DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../../../../org/apache/openjpa/jdbc/sql/BooleanRepresentationFactory.BooleanBooleanRepresentation.html" title="class in org.apache.openjpa.jdbc.sql">BooleanRepresentationFactory.BooleanBooleanRepresentation</A>, <A HREF="../../../../../org/apache/openjpa/jdbc/sql/BooleanRepresentationFactory.Int10BooleanRepresentation.html" title="class in org.apache.openjpa.jdbc.sql">BooleanRepresentationFactory.Int10BooleanRepresentation</A>, <A HREF="../../../../../org/apache/openjpa/jdbc/sql/BooleanRepresentationFactory.StringBooleanRepresentation.html" title="class in org.apache.openjpa.jdbc.sql">BooleanRepresentationFactory.StringBooleanRepresentation</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public interface <B>BooleanRepresentation&lt;REPRESENTATION_TYPE&gt;</B></DL>
</PRE>
<P>
<p>Defines how a <code>Boolean</code> or <code>boolean</code> value
gets stored in the database by default.</p>
<p>The <A HREF="../../../../../org/apache/openjpa/jdbc/sql/DBDictionary.html" title="class in org.apache.openjpa.jdbc.sql"><CODE>DBDictionary</CODE></A> defines a default representation for <code>Boolean</code>
and <code>boolean</code> fields in JPA entities. The <A HREF="../../../../../org/apache/openjpa/jdbc/sql/OracleDictionary.html" title="class in org.apache.openjpa.jdbc.sql"><CODE>OracleDictionary</CODE></A>
for example uses a <code>NUMBER(1)</code> with the values <code>(int) 1</code> and <code>(int) 0</code> by default.
However, sometimes you like to use a different default representation for Boolean values in your database.
If your application likes to store boolean values in a <code>CHAR(1)</code> field with <code>"T"</code> and
<code>"F"</code> values then you might configure the <A HREF="../../../../../org/apache/openjpa/jdbc/sql/DBDictionary.html" title="class in org.apache.openjpa.jdbc.sql"><CODE>DBDictionary</CODE></A>
to use the <code>"STRING_TF"</code> BooleanRepresentation:
<pre>
&lt;property name="openjpa.jdbc.DBDictionary"
value="(BitTypeName=CHAR(1),BooleanTypeName=CHAR(1),BooleanRepresentation=STRING_10)"/&gt
</pre>
Please note that you still need to adopt the mapping separately by setting the
<code>BitTypeName</code> and/or <code>BooleanTypeName</code> (depending on your database) to
the desired type in the database.
</p>
<p>The following <code>BooleanRepresentation</code> configuration options are possible:
<ul>
<li>One of the values of
<A HREF="../../../../../org/apache/openjpa/jdbc/sql/BooleanRepresentationFactory.html#BUILTIN_BOOLEAN_REPRESENTATIONS"><CODE>BooleanRepresentationFactory.BUILTIN_BOOLEAN_REPRESENTATIONS</CODE></A>
, e.g.:
<pre>
&lt;property name="openjpa.jdbc.DBDictionary" value="(BooleanRepresentation=STRING_YN)"/&gt
</pre>
</li>
<li>
Two slash (<code>'/'</code>) separated true/false value strings:
<pre>
&lt;property name="openjpa.jdbc.DBDictionary" value="(BooleanRepresentation=oui/non)"/&gt
</pre>
</li>
<li>
A fully qualified class name of your own <A HREF="../../../../../org/apache/openjpa/jdbc/sql/BooleanRepresentation.html" title="interface in org.apache.openjpa.jdbc.sql"><CODE>BooleanRepresentation</CODE></A>
implementation, e.g.:
<pre>
&lt;property name="openjpa.jdbc.DBDictionary"
value="(BooleanRepresentation=com.mycompany.MyOwnBoolRepresentation)"/&gt
</pre>
</li>
</ul>
</p>
<p>If a single column uses a different representation then they
still can tweak this for those columns with the
<code>org.apache.openjpa.persistence.ExternalValues</code> annotation.</p>
<P>
<P>
<HR>
<P>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/openjpa/jdbc/sql/BooleanRepresentation.html#getBoolean(java.sql.ResultSet, int)">getBoolean</A></B>(<A HREF="http://download.oracle.com/javase/6/docs/api/java/sql/ResultSet.html?is-external=true" title="class or interface in java.sql">ResultSet</A>&nbsp;rs,
int&nbsp;columnIndex)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Read the boolean from the given ResultSet</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../../../org/apache/openjpa/jdbc/sql/BooleanRepresentation.html" title="type parameter in BooleanRepresentation">REPRESENTATION_TYPE</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/openjpa/jdbc/sql/BooleanRepresentation.html#getRepresentation(boolean)">getRepresentation</A></B>(boolean&nbsp;bool)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../org/apache/openjpa/jdbc/sql/BooleanRepresentation.html#setBoolean(java.sql.PreparedStatement, int, boolean)">setBoolean</A></B>(<A HREF="http://download.oracle.com/javase/6/docs/api/java/sql/PreparedStatement.html?is-external=true" title="class or interface in java.sql">PreparedStatement</A>&nbsp;stmnt,
int&nbsp;columnIndex,
boolean&nbsp;val)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the boolean value into the statement</TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="setBoolean(java.sql.PreparedStatement, int, boolean)"><!-- --></A><H3>
setBoolean</H3>
<PRE>
void <B>setBoolean</B>(<A HREF="http://download.oracle.com/javase/6/docs/api/java/sql/PreparedStatement.html?is-external=true" title="class or interface in java.sql">PreparedStatement</A>&nbsp;stmnt,
int&nbsp;columnIndex,
boolean&nbsp;val)
throws <A HREF="http://download.oracle.com/javase/6/docs/api/java/sql/SQLException.html?is-external=true" title="class or interface in java.sql">SQLException</A></PRE>
<DL>
<DD>Set the boolean value into the statement
<P>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://download.oracle.com/javase/6/docs/api/java/sql/SQLException.html?is-external=true" title="class or interface in java.sql">SQLException</A></CODE></DL>
</DD>
</DL>
<HR>
<A NAME="getBoolean(java.sql.ResultSet, int)"><!-- --></A><H3>
getBoolean</H3>
<PRE>
boolean <B>getBoolean</B>(<A HREF="http://download.oracle.com/javase/6/docs/api/java/sql/ResultSet.html?is-external=true" title="class or interface in java.sql">ResultSet</A>&nbsp;rs,
int&nbsp;columnIndex)
throws <A HREF="http://download.oracle.com/javase/6/docs/api/java/sql/SQLException.html?is-external=true" title="class or interface in java.sql">SQLException</A></PRE>
<DL>
<DD>Read the boolean from the given ResultSet
<P>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://download.oracle.com/javase/6/docs/api/java/sql/SQLException.html?is-external=true" title="class or interface in java.sql">SQLException</A></CODE></DL>
</DD>
</DL>
<HR>
<A NAME="getRepresentation(boolean)"><!-- --></A><H3>
getRepresentation</H3>
<PRE>
<A HREF="../../../../../org/apache/openjpa/jdbc/sql/BooleanRepresentation.html" title="type parameter in BooleanRepresentation">REPRESENTATION_TYPE</A> <B>getRepresentation</B>(boolean&nbsp;bool)</PRE>
<DL>
<DD><DL>
<DT><B>Returns:</B><DD>return the representation for <code>true</code> and <code>false</code></DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/BooleanRepresentation.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../org/apache/openjpa/jdbc/sql/AccessDictionary.html" title="class in org.apache.openjpa.jdbc.sql"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../../org/apache/openjpa/jdbc/sql/BooleanRepresentationFactory.html" title="class in org.apache.openjpa.jdbc.sql"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/apache/openjpa/jdbc/sql/BooleanRepresentation.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="BooleanRepresentation.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright &#169; 2006&#x2013;2015 <a href="http://www.apache.org">Apache Software Foundation</a>. All rights reserved.
</BODY>
</HTML>