code_snippet
stringlengths
92
2.48k
score
float64
1.83
4.89
@SuppressWarnings( {"unchecked"}) @Test public void testAnyMappingReference() { Session s = openSession(); s.beginTransaction(); PropertyValue redValue = new StringPropertyValue( "red" ); PropertyValue loneliestNumberValue = new IntegerPropertyValue( 1 ); Long id; PropertySet ps = new PropertySet( "my p...
3.666667
@Test public void testFetchInSubqueryFails() { Session s = openSession(); try { s.createQuery( "from Animal a where a.mother in (select m from Animal a1 inner join a1.mother as m join fetch m.mother)" ).list(); fail( "fetch join allowed in subquery" ); } catch( QueryException expected ) { // expected ...
4.333333
@Test @TestForIssue( jiraKey = "HHH-429" ) @SuppressWarnings( {"unchecked"}) public void testSuperclassPropertyReferenceAfterCollectionIndexedAccess() { // note: simply performing syntax checking in the db Session s = openSession(); s.beginTransaction(); Mammal tiger = new Mammal(); tiger.setDescription( "...
3.777778
@Test @SuppressWarnings( {"UnusedAssignment", "UnusedDeclaration"}) public void testSelectExpressions() { createTestBaseData(); Session session = openSession(); Transaction txn = session.beginTransaction(); Human h = new Human(); h.setName( new Name( "Gavin", 'A', "King" ) ); h.setNickName("Oney"); h.se...
3.444444
/** * Build a normal attribute. * * @param ownerType The descriptor of the attribute owner (aka declarer). * @param property The Hibernate property descriptor for the attribute * @param <X> The type of the owner * @param <Y> The attribute type * * @return The built attribute descriptor or null if the at...
2.888889
@Test public void testOtherSyntax() throws Exception { parse( "select bar from org.hibernate.test.Bar bar order by ((bar.x - :valueX)*(bar.x - :valueX))" ); parse( "from bar in class org.hibernate.test.Bar, foo in elements(bar.baz.fooSet)" ); parse( "from one in class org.hibernate.test.One, many in elements(one....
3.888889
@Test public void testPathologicalKeywordAsIdentifier() throws Exception { // Super evil badness... a legitimate keyword! parse( "from Order order" ); //parse( "from Order order join order.group" ); parse( "from X x order by x.group.by.from" ); parse( "from Order x order by x.order.group.by.from" ); parse( ...
4
@Test public void testHHH1780() throws Exception { // verifies the tree contains a NOT->EXISTS subtree class Verifier { public boolean verify(AST root) { Stack<AST> queue = new Stack<AST>(); queue.push( root ); while ( !queue.isEmpty() ) { ...
3.222222
@Test public void testDateTimeArithmeticReturnTypesAndParameterGuessing() { QueryTranslatorImpl translator = createNewQueryTranslator( "select o.orderDate - o.orderDate from Order o" ); assertEquals( "incorrect return type count", 1, translator.getReturnTypes().length ); assertEquals( "incorrect return type", Do...
3.666667
@Test public void testExpressionWithParamInFunction() { assertTranslation("from Animal a where abs(a.bodyWeight-:param) < 2.0"); assertTranslation("from Animal a where abs(:param - a.bodyWeight) < 2.0"); assertTranslation("from Animal where abs(:x - :y) < 2.0"); assertTranslation("from Animal where lower(upper...
2.888889
@Test public void testHHH6635() throws Exception { MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); Set<ObjectName> set = mBeanServer.queryNames( null, null ); boolean mbeanfound = false; for ( ObjectName obj : set ) { if ( obj.getKeyPropertyListStrin...
3.666667
@Test public void testFilterApplicationOnHqlQueryWithImplicitSubqueryContainingPositionalParameter() { TestData testData = new TestData(); testData.prepare(); Session session = openSession(); session.beginTransaction(); final String queryString = "from Order o where ? in ( select sp.name from Salesperson s...
4.222222
@SuppressWarnings( {"unchecked"}) @Test public void testDistinctSelectWithJoin() { feedDatabase(); Session s = openSession(); List<Entry> entries = s.createQuery("select distinct e from Entry e join e.tags t where t.surrogate != null order by e.name").setFirstResult(10).setMaxResults(5).list(); // System.o...
4.555556
@Test @SkipForDialect( value = { MySQLMyISAMDialect.class, AbstractHANADialect.class }, comment = "MySQL (MyISAM) / Hana do not support FK violation checking" ) public void testIntegrityViolation() throws Exception { final Session session = openSession(); session.beginTransaction(); session.doWork( ...
3.666667
@Test public void testBadGrammar() throws Exception { final Session session = openSession(); session.beginTransaction(); session.doWork( new Work() { @Override public void execute(Connection connection) throws SQLException { // prepare/execute a query against a non-existent table Prepa...
3.222222
private void releaseStatement(Session session, PreparedStatement ps) { if ( ps != null ) { try { ( (SessionImplementor) session ).getTransactionCoordinator().getJdbcCoordinator().release( ps ); } catch ( Throwable ignore ) { // ignore... } } }
3.888889
@Test public void testEntityWithLazyAssnList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { protected Criteria getCriteria(Session s) { // should use RootEntityTransformer by default return s.createCriteria( Student.class ) .addOrder( Order.asc( "studentNumber" ) )...
3.111111
@Test public void testJoinWithFetchJoinListCriteria() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { protected Criteria getCriteria(Session s) { return s.createCriteria( Student.class, "s" ) .createAlias( "s.preferredCourse", "pc", Criteria.LEFT_JOIN ) .setFetchMo...
2.777778
@Test public void testEntityWithAliasedJoinFetchedLazyOneToManySingleElementListHql() throws Exception { HqlExecutor hqlExecutor = new HqlExecutor() { public Query getQuery(Session s) { return s.createQuery( "from Student s left join fetch s.enrolments e order by s.studentNumber" ); } }; ResultChecker...
3
@Test public void testMultiSelectNewMapUsingAliasesWithFetchJoinList() throws Exception { CriteriaExecutor criteriaExecutor = new CriteriaExecutor() { protected Criteria getCriteria(Session s) { return s.createCriteria( Student.class, "s" ) .createAlias( "s.preferredCourse", "pc", Criteria.LEFT_JOIN ) ...
3.222222
public void afterSessionFactoryBuilt() { super.afterSessionFactoryBuilt(); final Session session = sessionFactory().openSession(); session.doWork( new Work() { @Override public void execute(Connection connection) throws SQLException { Statement st = ((SessionImplementor)session).getTransaction...
3.666667
@Test public void testNoLoss() { assertNoLoss( "insert into Address (city, state, zip, \"from\") values (?, ?, ?, 'insert value')" ); assertNoLoss( "delete from Address where id = ? and version = ?" ); assertNoLoss( "update Address set city = ?, state=?, zip=?, version = ? where id = ? and version = ?" ); asse...
3.333333
/** * Throws {@link org.hibernate.PropertyValueException} if there are any unresolved * entity insert actions that depend on non-nullable associations with * a transient entity. This method should be called on completion of * an operation (after all cascades are completed) that saves an entity. * * @throws ...
3.333333
/** * Handle sending notifications needed for natural-id after saving * * @param generatedId The generated entity identifier */ public void handleNaturalIdPostSaveNotifications(Serializable generatedId) { if ( isEarlyInsert() ) { // with early insert, we still need to add a local (transactional) natural i...
3.888889
private boolean initializeLazyProperty( final String fieldName, final Object entity, final SessionImplementor session, final Object[] snapshot, final int j, final Object propValue) { setPropertyValue( entity, lazyPropertyNumbers[j], propValue ); if ( snapshot != null ) { // object have been loa...
3.888889
private void initOrdinaryPropertyPaths(Mapping mapping) throws MappingException { for ( int i = 0; i < getSubclassPropertyNameClosure().length; i++ ) { propertyMapping.initPropertyPaths( getSubclassPropertyNameClosure()[i], getSubclassPropertyTypeClosure()[i], getSubclassPropertyColumnNameClosure()[i], ...
3.888889
/** * Delete an object */ public void delete(Serializable id, Object version, Object object, SessionImplementor session) throws HibernateException { final int span = getTableSpan(); boolean isImpliedOptimisticLocking = !entityMetamodel.isVersioned() && isAllOrDirtyOptLocking(); Object[] loadedState = null...
3.555556
private UniqueEntityLoader getAppropriateLoader(LockOptions lockOptions, SessionImplementor session) { if ( queryLoader != null ) { // if the user specified a custom query loader we need to that // regardless of any other consideration return queryLoader; } else if ( isAffectedByEnabledFilters( session )...
3.888889
public String[] toColumns(String alias, String propertyName) throws QueryException { if ( propertyName.equals(CollectionPropertyNames.COLLECTION_ELEMENTS) ) { return memberPersister.getElementColumnNames(alias); } else if ( propertyName.equals(CollectionPropertyNames.COLLECTION_INDICES) ) { if ( !memberPers...
3.333333
private void bindIndex(final Mappings mappings) { if ( !indexColumn.isImplicit() ) { PropertyHolder valueHolder = PropertyHolderBuilder.buildPropertyHolder( this.collection, StringHelper.qualify( this.collection.getRole(), "key" ), null, null, propertyHolder, mappings ); List list = (List...
3
/** * Perform {@link org.hibernate.action.spi.Executable#execute()} on each element of the list * * @param list The list of Executable elements to be performed * * @throws HibernateException */ private <E extends Executable & Comparable<?> & Serializable> void executeActions(ExecutableList<E> list) throws...
3.555556
@SuppressWarnings( {"SimplifiableIfStatement"}) private boolean isUnequivocallyNonDirty(Object entity) { if(entity instanceof SelfDirtinessTracker) return ((SelfDirtinessTracker) entity).$$_hibernate_hasDirtyAttributes(); final CustomEntityDirtinessStrategy customEntityDirtinessStrategy = persistenceConte...
3
public static String expandBatchIdPlaceholder( String sql, Serializable[] ids, String alias, String[] keyColumnNames, Dialect dialect) { if ( keyColumnNames.length == 1 ) { // non-composite return StringHelper.replace( sql, BATCH_ID_PLACEHOLDER, repeat( "?", ids.length, "," ) ); } else { /...
3.888889
/** * Interpret a long as its binary form * * @param longValue The long to interpret to binary * * @return The binary */ public static byte[] fromLong(long longValue) { byte[] bytes = new byte[8]; bytes[0] = (byte) ( longValue >> 56 ); bytes[1] = (byte) ( ( longValue << 8 ) >> 56 ); bytes[2] = (byt...
4.111111
/** * Tests this instance for equality with an arbitrary object. * * @param obj the object (<code>null</code> permitted). * * @return A boolean. */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanc...
4.666667
public final void caseSList() throws RecognitionException, TokenStreamException { { _loop119: do { if ((_tokenSet_6.member(LA(1)))) { statement(); } else { break _loop119; } } while (true); } }
3.333333
public void write(BufferedReader reader, BufferedWriter writer, Stack parseStateStack) throws IOException { ParseState parseState = (ParseState) parseStateStack.peek(); Object mInterface = /*(MInterface)*/ parseState.newClassifier(name); if (mInterface != nu...
3.555556
protected final void mHEX_DIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { int _ttype; Token _token=null; int _begin=text.length(); _ttype = HEX_DIGIT; int _saveIndex; { switch ( LA(1)) { case '0': case '1': case '2': case '3': case '4': case '5':...
3.555556
/** * The constructor. */ public TabChecklist() { super("tab.checklist"); tableModel = new TableModelChecklist(this); table.setModel(tableModel); Font labelFont = LookAndFeelMgr.getInstance().getStandardFont(); table.setFont(labelFont); table.setIntercellSpacing(new Dimension(0, 1)); table.setSh...
3.888889
public void vetoableChange(PropertyChangeEvent pce) { if ("ownedElement".equals(pce.getPropertyName())) { Vector oldOwned = (Vector) pce.getOldValue(); Object eo = pce.getNewValue(); Object me = Model.getFacade().getModelElement(eo); if (oldOwned.contains(eo)) { ...
4.111111
public List getInEdges(Object port) { Vector res = new Vector(); //wasteful! if (Model.getFacade().isAClassifierRole(port)) { Object cr = port; Collection ends = Model.getFacade().getAssociationEnds(cr); if (ends == null) { return res; // empty Vector } Iterator iter = ...
3.888889
/** * Displays visual indications of pending ToDoItems. * Please note that the list of advices (ToDoList) is not the same * as the list of element known by the FigNode (_figs). Therefore, * it is necessary to check if the graphic item exists before drawing * on it. See ClAttributeCompartment fo...
3.333333
public void mouseMoved(MouseEvent me) { //- RedrawManager.lock(); translateMouseEvent(me); Globals.curEditor(this); setUnderMouse(me); Fig currentFig = getCurrentFig(); if (currentFig != null && Globals.getShowFigTips()) { String tip = currentFig.getTipString(me); if (tip != null && (getJComponen...
3.222222
public Set getDependencies(Object parent) { if (Model.getFacade().isAClass(parent)) { Set set = new HashSet(); set.add(parent); set.addAll(Model.getFacade().getAttributes(parent)); set.addAll(Model.getFacade().getOperations(parent)); set.addAll(Model.getFacade().getAssociationEnds(paren...
4.666667
@Test public void listenersAreCalledCorrectlyInTheFaceOfFailures() throws Exception { JUnitCore core = new JUnitCore(); final List<Failure> failures = new ArrayList<Failure>(); core.addListener(new RunListener() { @Override public void testRunFinished(Resu...
3.222222
private Exception createTimeoutException(Thread thread) { StackTraceElement[] stackTrace = thread.getStackTrace(); final Thread stuckThread = fLookForStuckThread ? getStuckThread(thread) : null; Exception currThreadException = new Exception(String.format( "test timed out after %d...
2.888889
/** * Build the metamodel using the information from the collection of Hibernate * {@link PersistentClass} models as well as the Hibernate {@link org.hibernate.SessionFactory}. * * @param persistentClasses Iterator over the Hibernate (config-time) metamodel * @param mappedSuperclasses All known MappedSupercla...
3.111111
@Test public void testExplicitJoining() throws Exception { assertFalse( JtaStatusHelper.isActive( TestingJtaPlatformImpl.INSTANCE.getTransactionManager() ) ); SessionImplementor session = (SessionImplementor) sessionFactory().withOptions().autoJoinTransactions( false ).openSession(); TransactionImplementor tran...
2.777778
@Test public void testImplicitJoining() throws Exception { assertFalse( JtaStatusHelper.isActive( TestingJtaPlatformImpl.INSTANCE.getTransactionManager() ) ); TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin(); assertTrue( JtaStatusHelper.isActive( TestingJtaPlatformImpl.INSTANCE.getTransactionMana...
3.333333
public void testOneToOnePropertyRefGeneratedIds() { try { Session s = openSession(); s.beginTransaction(); Child c2 = new Child( "c2" ); ChildInfo info = new ChildInfo( "blah blah blah" ); c2.setInfo( info ); info.setOwner( c2 ); s.persist( c2 ); try { s.getTransaction().commit(); fail...
4.111111
@Test public void testBuildEntityCollectionRegionOverridesOnly() { AdvancedCache cache; Properties p = new Properties(); p.setProperty("hibernate.cache.infinispan.entity.eviction.strategy", "LIRS"); p.setProperty("hibernate.cache.infinispan.entity.eviction.wake_up_interval", "3000"); p....
3.222222
@Test public void testBuildEntityRegionPersonPlusEntityOverridesWithoutCfg() { final String person = "com.acme.Person"; Properties p = new Properties(); // Third option, no cache defined for entity and overrides for generic entity data type and entity itself. p.setProperty("hibernate.cache.in...
3.333333
private InfinispanRegionFactory createRegionFactory(final EmbeddedCacheManager manager, Properties p) { final InfinispanRegionFactory factory = new SingleNodeTestCase.TestInfinispanRegionFactory() { @Override protected org.infinispan.transaction.lookup.TransactionManagerLookup createTransaction...
2.888889
@Test public void testAcceptsUnresolvedPropertyTypesIfATargetEntityIsExplicitlySet() { Session s = openSession(); Transaction tx = s.beginTransaction(); Gene item = new Gene(); s.persist( item ); s.flush(); tx.rollback(); s.close(); }
4.555556
@Test @TestForIssue( jiraKey = "HHH-4685" ) public void testOneToManyEmbeddableBiDirectionalDotNotationInMappedBy() throws Exception { // Section 11.1.26 // The ManyToOne annotation may be used within an embeddable class to specify a relationship from the embeddable // class to an entity class. If the relations...
3.777778
@Test public void testAssociationRelatedAnnotations() throws Exception { XMLContext context = buildContext( "org/hibernate/test/annotations/reflection/orm.xml" ); Field field = Administration.class.getDeclaredField( "defaultBusTrip" ); JPAOverriddenAnnotationReader reader = new JPAOverriddenAnnotationReader( fi...
2.666667
@Test @TestForIssue(jiraKey = "HHH-4699") @SkipForDialect(value = { Oracle8iDialect.class, AbstractHANADialect.class }, jiraKey = "HHH-8516", comment = "HHH-4699 was specifically for using a CHAR, but Oracle/HANA do not handle the 2nd query correctly without VARCHAR. ") public void testTrimmedEnumChar() throws SQ...
3.666667
@Test public void testWithEJB3NamingStrategy() throws Exception { SessionFactory sf = null; try { AnnotationConfiguration config = new AnnotationConfiguration(); config.setNamingStrategy(EJB3NamingStrategy.INSTANCE); config.addAnnotatedClass(A.class); config.addAnnotatedClass(AddressEntry.class); s...
3
@Test @SkipForDialects( { @SkipForDialect( value = { HSQLDialect.class }, comment = "The used join conditions does not work in HSQLDB. See HHH-4497." ), @SkipForDialect( value = { SQLServer2005Dialect.class } ), @SkipForDialect( value = { Oracle8iDialect.class }, comment = "Oracle/DB2 do not support 'substri...
3.777778
public CollectionListeners( SessionFactory sf) { preCollectionRecreateListener = new PreCollectionRecreateListener( this ); initializeCollectionListener = new InitializeCollectionListener( this ); preCollectionRemoveListener = new PreCollectionRemoveListener( this ); preCollectionUpdateListener = new PreCollect...
4.111111
@Test public void testUpdateParentOneChildDiffCollectionDiffChild() { CollectionListeners listeners = new CollectionListeners( sessionFactory() ); ParentWithCollection parent = createParentWithOneChild( "parent", "child" ); Child oldChild = ( Child ) parent.getChildren().iterator().next(); listeners.clear(); ...
2.444444
public int hashCode() { final int PRIME = 31; int result = 1; if ( name != null ) { result += name.hashCode(); } result *= PRIME; if ( num != null ) { result += num.hashCode(); } return result; }
4.333333
@Test public void testCascadeBasedBuild() { EntityPersister ep = (EntityPersister) sessionFactory().getClassMetadata(Message.class); CascadeStyleLoadPlanBuildingAssociationVisitationStrategy strategy = new CascadeStyleLoadPlanBuildingAssociationVisitationStrategy( CascadingActions.MERGE, sessionFactory(), ...
3.111111
public LoadPlan buildLoadPlan( SessionFactoryImplementor sf, OuterJoinLoadable persister, LoadQueryInfluencers influencers, LockMode lockMode) { FetchStyleLoadPlanBuildingAssociationVisitationStrategy strategy = new FetchStyleLoadPlanBuildingAssociationVisitationStrategy( sf, influencers, lock...
3.333333
private void compare(JoinWalker walker, LoadQueryDetails details) { System.out.println( "------ SQL -----------------------------------------------------------------" ); System.out.println( "WALKER : " + walker.getSQLString() ); System.out.println( "LOAD-PLAN : " + details.getSqlStatement() ); System.out.pri...
4.888889
@Test public void testExceptionHandling() { Session session = openSession(); SessionImplementor sessionImpl = (SessionImplementor) session; boolean caught = false; try { PreparedStatement ps = sessionImpl.getTransactionCoordinator().getJdbcCoordinator().getStatementPreparer() .prepareStatement( "select...
3.888889
private void doBasicPluralAttributeBinding(PluralAttributeSource source, AbstractPluralAttributeBinding binding) { binding.setFetchTiming( source.getFetchTiming() ); binding.setFetchStyle( source.getFetchStyle() ); binding.setCascadeStyles( source.getCascadeStyles() ); binding.setCaching( source.getCaching() )...
2.777778
private void pushHibernateTypeInformationDownIfNeeded( HibernateTypeDescriptor hibernateTypeDescriptor, Value value, Type resolvedHibernateType) { if ( resolvedHibernateType == null ) { return; } if ( hibernateTypeDescriptor.getResolvedTypeMapping() == null ) { hibernateTypeDescriptor.setResolvedTy...
3.444444
public static Iterable<AttributeDefinition> getCompositeCollectionIndexSubAttributes(CompositeCollectionElementDefinition compositionElementDefinition){ final QueryableCollection collectionPersister = (QueryableCollection) compositionElementDefinition.getCollectionDefinition().getCollectionPersister(); return g...
3
/** * As per sections 12.2.3.23.9, 12.2.4.8.9 and 12.2.5.3.6 of the JPA 2.0 * specification, the element-collection subelement completely overrides the * mapping for the specified field or property. Thus, any methods which * might in some contexts merge with annotations must not do so in this * context. */...
2.888889
@Override public void release() { if ( reader == null ) { return; } try { reader.close(); } catch (IOException ignore) { } }
4.777778
@Override protected XMLEvent internalNextEvent() throws XMLStreamException { //If there is an iterator to read from reset was called, use the iterator //until it runs out of events. if (this.bufferReader != null) { final XMLEvent event = this.bufferReader.next(); //If nothing left in the iterator, remove ...
4.555556
@Override public final String getElementText() throws XMLStreamException { XMLEvent event = this.previousEvent; if (event == null) { throw new XMLStreamException("Must be on START_ELEMENT to read next text, element was null"); } if (!event.isStartElement()) { throw new XMLStreamException("Must be on STAR...
4.111111
public Point getClosestPoint(Point anotherPt) { Rectangle r = getBounds(); int[] xs = {r.x + r.width / 2, r.x + r.width, r.x + r.width / 2, r.x, r.x + r.width / 2, }; int[] ys = {r.y, r.y ...
4.333333
protected void modelChanged(PropertyChangeEvent mee) { super.modelChanged(mee); final Object trCollection = mee.getNewValue(); final String eName = mee.getPropertyName(); final Object owner = getOwner(); /* * A Concurrent region cannot have incoming or outgoing transitio...
3
public void setEnclosingFig(Fig encloser) { if (getOwner() != null) { Object nod = getOwner(); if (encloser != null) { Object comp = encloser.getOwner(); if (Model.getFacade().isAComponentInstance(comp)) { if (Model.getFacade().getCompo...
2.888889
protected Object[] getUmlActions() { Object[] actions = { getActionPackage(), getActionClass(), null, getAssociationActions(), getAggregationActions(), getCompositionActions(), getActionAssociationEnd(), getActionGen...
3.222222
public void buildModel() { if (getTarget() != null) { Object target = getTarget(); Object kind = Model.getFacade().getAggregation(target); if (kind == null || kind.equals( Model.getAggregationKind().getNone())) { ...
2.555556
/** * Construct a property panel for Node Instance elements. */ public PropPanelNodeInstance() { super("Node Instance", lookupIcon("NodeInstance"), ConfigLoader.getTabPropsOrientation()); addField(Translator.localize("label.name"), getNameTextField()); addField(Tra...
2.666667
@Test public void shouldReturnOnlyTheNamedDataPoints() throws Throwable { SpecificDataPointsSupplier supplier = new SpecificDataPointsSupplier(new TestClass(TestClassWithNamedDataPoints.class)); List<PotentialAssignment> assignments = supplier.getValueSources(signature("methodWantingAllNamedStrings...
3.666667
@Test public void throwTimeoutExceptionOnSecondCallAlthoughFirstCallThrowsException() throws Throwable { thrown.expectMessage("test timed out after 100 milliseconds"); try { evaluateWithException(new RuntimeException()); } catch (Throwable expected) { } ...
4.333333
@Test public void stackTraceContainsRealCauseOfTimeout() throws Throwable { StuckStatement stuck = new StuckStatement(); FailOnTimeout stuckTimeout = new FailOnTimeout(stuck, TIMEOUT); try { stuckTimeout.evaluate(); // We must not get here, we expect a timeout excepti...
3.555556
@Test public void testQueryCacheModes() { EntityManager em = getOrCreateEntityManager(); Query jpaQuery = em.createQuery( "from SimpleEntity" ); AbstractQueryImpl hibQuery = (AbstractQueryImpl) ( (HibernateQuery) jpaQuery ).getHibernateQuery(); jpaQuery.setHint( AvailableSettings.SHARED_CACHE_STORE_MODE, Cach...
2.666667
@Test public void testRestrictedCorrelationNoExplicitSelection() { CriteriaBuilder builder = entityManagerFactory().getCriteriaBuilder(); EntityManager em = getOrCreateEntityManager(); em.getTransaction().begin(); CriteriaQuery<Order> criteria = builder.createQuery( Order.class ); Root<Order> orderRoot = cr...
2.888889
/** * Get the value mapped to this key, or null if no value is mapped to this key. * * @param key The cache key * * @return The cached data */ public final Object get(Object key) { try { final Element element = getCache().get( key ); if ( element == null ) { return null; } else { retu...
4.222222
@Test public void testModFlagProperties() { assertEquals( TestTools.makeSet( "comp1_MOD" ), TestTools.extractModProperties( getCfg().getClassMapping( "org.hibernate.envers.test.entities.components.ComponentTestEntity_AUD" ) ) ); }
4.333333
@Test public void testHistoryOfEdIng2() { SetOwnedEntity ed1 = getEntityManager().find( SetOwnedEntity.class, ed1_id ); SetOwnedEntity ed2 = getEntityManager().find( SetOwnedEntity.class, ed2_id ); SetOwningEntity rev1 = getAuditReader().find( SetOwningEntity.class, ing2_id, 1 ); SetOwningEntity rev2 = getAud...
3.666667
@Test public void testTernaryMap() { final TernaryMapEntity ternaryMap = new TernaryMapEntity(); ternaryMap.setId( ternaryMapId ); ternaryMap.getMap().put( intEntity1, stringEntity1 ); ternaryMap.getMap().put( new IntTestPrivSeqEntity( 2, intEntity2.getId() ) , new StrTestPrivSeqEntity( "Value 2", stringEntity...
2.777778
@Test @Priority(10) public void initData() { EntityManager em = getEntityManager(); // Revision 1 em.getTransaction().begin(); country = Country.of( 123, "Germany" ); em.persist( country ); em.getTransaction().commit(); }
4.555556
@Override public boolean equals(Object obj) { if ( this == obj ) { return true; } if ( !super.equals( obj ) ) { return false; } if ( getClass() != obj.getClass() ) { return false; } VersionsJoinTableRangeTestAlternateEntity other = (VersionsJoinTableRangeTestAlternateEntity) obj; if ( alternat...
4.222222
private Element createMiddleEntityXml(String auditMiddleTableName, String auditMiddleEntityName, String where) { final String schema = mainGenerator.getSchema( propertyAuditingData.getJoinTable().schema(), propertyValue.getCollectionTable() ); final String catalog = mainGenerator.getCatalog( propertyA...
3.111111
private void addTransactionFactories(StrategySelectorImpl strategySelector) { strategySelector.registerStrategyImplementor( TransactionFactory.class, JdbcTransactionFactory.SHORT_NAME, JdbcTransactionFactory.class ); strategySelector.registerStrategyImplementor( TransactionFactory.class, "org.hibernate.transaction....
3.888889
@Override public String call() throws Exception { try { if (isTrace) log.tracef("[%s] Wait for all executions paths to be ready to perform calls", title(warmup)); barrier.await(); long start = System.nanoTime(); int runs = 0; if ...
3.666667
private void registeredPutWithInterveningRemovalTest( final boolean transactional, final boolean removeRegion) throws Exception { withCacheManager(new CacheManagerCallable( TestCacheManagerFactory.createCacheManager(false)) { @Override public void call() { ...
2.777778
@Override protected void prepareBootstrapRegistryBuilder(BootstrapServiceRegistryBuilder builder) { super.prepareBootstrapRegistryBuilder( builder ); builder.with( new Integrator() { @Override public void integrate( Configuration configuration, SessionFactoryImplementor sessionFacto...
3.444444
@Test @TestForIssue( jiraKey = "HHH-2277") public void testLoadEntityWithEagerFetchingToKeyManyToOneReferenceBackToSelf() { sessionFactory().getStatistics().clear(); // long winded method name to say that this is a test specifically for HHH-2277 ;) // essentially we have a bidirectional association where one s...
4
@Test public void testNoChildren() throws Exception { reader = getReader( Entity2.class, "field1", "element-collection.orm1.xml" ); assertAnnotationPresent( ElementCollection.class ); assertAnnotationNotPresent( OrderBy.class ); assertAnnotationNotPresent( OrderColumn.class ); assertAnnotationNotPresent( Map...
3.555556
@Test public void testMultipleMapKeyAttributeOverrides() throws Exception { reader = getReader( Entity3.class, "field1", "element-collection.orm11.xml" ); assertAnnotationPresent( ElementCollection.class ); assertAnnotationNotPresent( MapKey.class ); assertAnnotationNotPresent( MapKeyClass.class ); assertAnn...
2.888889
@Test public void testExplicitPropertyAccessAnnotationsWithHibernateStyleOverride() throws Exception { AnnotationConfiguration cfg = new AnnotationConfiguration(); Class<?> classUnderTest = Course3.class; cfg.addAnnotatedClass( classUnderTest ); cfg.addAnnotatedClass( Student.class )...
3.222222
@Test @TestForIssue( jiraKey = "HHH-7309" ) public void testInsertUpdateEntity_NaturalIdCachedAfterTransactionSuccess() { Session session = openSession(); session.getSessionFactory().getStatistics().clear(); session.beginTransaction(); Another it = new Another( "it"); session.save( it ); // schedules ...
3.222222