Package org.hibernate

Examples of org.hibernate.FlushMode


        if (id == null) return null;
        final List<Section> candidates = new ArrayList<Section>();
        try {
            new HibernateTxFragment() {
                protected void txFragment(Session session) throws Exception {
                    FlushMode oldFlushMode = session.getFlushMode();
                    session.setFlushMode(FlushMode.NEVER);
                    Query query = session.createQuery("from " + Section.class.getName() + " as section " +
                            "where section.workspace=:workspace and section.sectionId=:pageid");

                    query.setParameter("workspace", WorkspaceImpl.this);
View Full Code Here


        if (id == null) return null;
        final List<PanelInstance> candidates = new ArrayList<PanelInstance>();
        try {
            new HibernateTxFragment() {
                protected void txFragment(Session session) throws Exception {
                    FlushMode oldFlushMode = session.getFlushMode();
                    session.setFlushMode(FlushMode.NEVER);
                    Query query = session.createQuery("from " + PanelInstance.class.getName() + " as instance " +
                            "where instance.workspace=:workspace and instance.instanceId=:instid");

                    query.setParameter("workspace", WorkspaceImpl.this);
View Full Code Here

        if (friendlyUrl == null) return null;
        final List<Section> candidates = new ArrayList<Section>();
        try {
            new HibernateTxFragment() {
                protected void txFragment(Session session) throws Exception {
                    FlushMode oldFlushMode = session.getFlushMode();
                    session.setFlushMode(FlushMode.NEVER);
                    Query query = session.createQuery("from " + Section.class.getName() + " as section " +
                            "where section.workspace=:workspace and section.friendlyUrl=:pageid");

                    query.setParameter("workspace", WorkspaceImpl.this);
View Full Code Here

    public Panel getPaneltByDbId(final Long panelId) throws Exception {
        if (panelId != null) {
            final List<Panel> results = new ArrayList<Panel>();
            new HibernateTxFragment() {
            protected void txFragment(Session session) throws Exception {
                FlushMode flushMode = session.getFlushMode();
                session.setFlushMode(FlushMode.COMMIT);

                StringBuffer sql = new StringBuffer();
                sql.append("select p ");
                sql.append("from ").append(Panel.class.getName()).append(" as p ");
View Full Code Here

    public Panel getPaneltById(final Long panelId) throws Exception {
        final List<Panel> results = new ArrayList<Panel>();
        new HibernateTxFragment() {
        protected void txFragment(Session session) throws Exception {
            FlushMode flushMode = session.getFlushMode();
            session.setFlushMode(FlushMode.COMMIT);

            StringBuffer sql = new StringBuffer();
            sql.append("select p ");
            sql.append("from ").append(Panel.class.getName()).append(" as p ");
View Full Code Here

        final Set<PanelInstance> results = new HashSet<PanelInstance>();
        if(value == null || paramId == null) return results;

        new HibernateTxFragment() {
        protected void txFragment(Session session) throws Exception {
            FlushMode flushMode = session.getFlushMode();
            session.setFlushMode(FlushMode.COMMIT);

            StringBuffer sql = new StringBuffer();
            sql.append("select p ");
            sql.append("from ").append(PanelInstance.class.getName()).append(" as p join p.panelParams as param ");
View Full Code Here

    public Set<DataProvider> getAllDataProviders() throws Exception {
        final Set<DataProvider> results = new HashSet<DataProvider>();
        new HibernateTxFragment() {
        protected void txFragment(Session session) throws Exception {
            FlushMode flushMode = session.getFlushMode();
            session.setFlushMode(FlushMode.COMMIT);
            Query query = session.createQuery("from " + DataProviderImpl.class.getName() + " order by id");
            query.setCacheable(true);
            results.addAll(query.list());
            session.setFlushMode(flushMode);
View Full Code Here

    public DataProvider getDataProviderById(final Long id) throws Exception {
        final List<DataProvider> results = new ArrayList<DataProvider>();
        new HibernateTxFragment() {
        protected void txFragment(Session session) throws Exception {
            FlushMode flushMode = session.getFlushMode();
            session.setFlushMode(FlushMode.COMMIT);

            StringBuffer sql = new StringBuffer();
            sql.append("from ").append(DataProviderImpl.class.getName()).append(" as instance ");
            sql.append("where instance.id = :id");
View Full Code Here

    public DataProvider getDataProviderByCode(final String code) throws Exception {
        final List<DataProvider> results = new ArrayList<DataProvider>();
        new HibernateTxFragment() {
        protected void txFragment(Session session) throws Exception {
            FlushMode flushMode = session.getFlushMode();
            session.setFlushMode(FlushMode.COMMIT);

            StringBuffer sql = new StringBuffer();
            sql.append("from ").append(DataProviderImpl.class.getName()).append(" as instance ");
            sql.append("where instance.code = :code");
View Full Code Here

    if ( queryAnn == null ) return;
    if ( BinderHelper.isEmptyAnnotationValue( queryAnn.name() ) ) {
      throw new AnnotationException( "A named query must have a name when used in class or package level" );
    }

    FlushMode flushMode;
    flushMode = getFlushMode( queryAnn.flushMode() );

    NamedQueryDefinition query = new NamedQueryDefinition(
        queryAnn.query(),
        queryAnn.cacheable(),
View Full Code Here

TOP

Related Classes of org.hibernate.FlushMode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.