AskDefine | Define persist

Dictionary Definition

persist

Verb

1 continue to exist; "These stories die hard"; "The legend of Elvis endures" [syn: prevail, die hard, run, endure]
2 be persistent, refuse to stop; "he persisted to call me every night"; "The child persisted and kept asking questions" [syn: persevere, hang in, hang on, hold on]
3 stay behind; "The smell stayed in the room"; "The hostility remained long after they made up" [syn: remain, stay]

User Contributed Dictionary

English

Pronunciation

Verb

  1. To go on stubbornly or resolutely.
  2. To repeat an utterance.
  3. To continue to exist.

Derived terms

Translations

continue to exist

Extensive Definition

Persist is a Java-based ORM/DAO tool. It provides only the minimal amount of functionalities necessary to map objects or maps from database queries and to statement parameters.
Persist works around a java.sql.Connection object. This means that it does not care about customer query languages (it uses plain SQL with placeholders, as PreparedStatement objects use), connection pool handling, transaction handling (for the most part), and so on. This also means it is very flexible, and can be integrated with any code that depends on JDBC (including code that already use another ORM/DAO tool).
Persist does not require explicit mappings from POJOs to database tables. As long as there is some sort of naming conventions that relate database names with POJO names, Persist will require virtually no mappings. It can, however, be instructed to map Java classes and fields to database tables and columns using annotations.
Persist supports several different mapping strategies:
POJOs mapped to tables
By default, if no annotations specify a given class should not be mapped to a table, Persist will try to find a table that matches that class and create a mapping between fields and columns.
// inserts a new customer (the class Customer is mapped to the table customer automatically) persist.insert(customer); // reads a customer by its primary key Customer c = persist.readByPrimaryKey(Customer.class, 42); // retrieves customers using a custom query (note the usage of varargs) List list = persist.readList(Customer.class, "select * from customer where id > ?", 10); // fetch all customers and assign the ResultSet to an Iterator Iterator allCustomersIterator = persist.readIterator(Customer.class, "select * from customer");
POJOs not mapped to tables
If a class is annotated with @NoTable, Persist will not try to map it to a table, and the class will only be able to hold data produced by queries.
@NoTable class QueryData
QueryData qd1 = persist.read(QueryData.class, "select 1 as count, 'hello' as concat_name from dual");
java.util.Map's
Map's can be used to hold data from queries. Persist will convert values returned from the query to Java types. Keys in the table are the names of the columns returned in lower case.
// fetch a customer using a custom query and return the result as a map Map customerMap = persist.readMap("select * from customer where id=?", 10); // fetch all customers and result the results as Map instances in a List List> customerMapList = persist.readMapList("select * from customer"); // fetch all customers and assign the ResultSet to an Iterator which maps rows to Map instances Iterator allCustomersIterator = persist.readMapIterator("select * from customer");
Java primitive types
If a query returns a single column, Persist can map data directly into primitive types (either single values or lists):
// return customer name as String String name = persist.read(String.class, "select name from customer where id=?", 55); // fetch all customer id's as a list of integers List ids = persist.readList(Integer.class, "select id from customer");
Custom queries with no returning data
Arbitrary queries that return no data can be easily executed.
// execute arbitrary SQL with parameters persist.executeUpdate("delete from customer where id in (?,?)", 10, 20);

See also

External links

persist in Spanish: Persist
persist in French: Persist
persist in Portuguese: Persist
persist in Chinese: Persist

Synonyms, Antonyms and Related Words

abide, adhere, agglomerate, assert, be spared, bide, bottle up, brook no denial, bunch, carry on, carry through, cheat death, clasp, cleave, clinch, cling, cling to, clot, cluster, coagulate, cohere, congeal, conglomerate, contend, continue, continue the same, continue to be, continue to exist, cork up, defeat time, defy time, drag along, drag on, drone, dwell, embrace, endure, exist, extend, freeze to, get along, get on, go on, go on with, grasp, grow together, hang in, hang on, hang together, hang tough, hold, hold in, hold on, hold out, hold together, hug, hum, inhibit, insist, insist on, insist upon, keep, keep alive, keep at, keep at it, keep driving, keep going, keep in, keep on, keep trying, keep up, labor, last, last long, last out, linger, live, live on, live through, lock in, maintain, make out, manage, mass, never say die, not accept compromise, obtain, perdure, perennate, persevere, preserve, press, prevail, remain, repress, retain, run, run on, run through, save, save up, see it through, set, solidify, stand, stand fast, stand firm, stand on, stay, stay on, stay put, stick, stick it out, stick to, stick to it, stick together, strive, subsist, support life, suppress, survive, sustain, take hold of, take no denial, tarry, tide over, toil, urge, wear, wear well
Privacy Policy, About Us, Terms and Conditions, Contact Us
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2
Material from Wikipedia, Wiktionary, Dict
Valid HTML 4.01 Strict, Valid CSS Level 2.1